Struct speedy2d::GLRenderer[][src]

pub struct GLRenderer { /* fields omitted */ }

A graphics renderer using an OpenGL backend.

Note: There is no need to use this struct if you are letting Speedy2D create a window for you.

Implementations

impl GLRenderer[src]

pub unsafe fn new_for_current_context<V: Into<Vector2<u32>>>(
    viewport_size_pixels: V
) -> Result<Self, BacktraceError<GLRendererCreationError>>
[src]

Creates a GLRenderer for the current OpenGL context. viewport_size_pixels should be set to the initial viewport size, however this can be changed later using [GLRenderer:: set_viewport_size_pixels()].

Note: This function must not be called if you are letting Speedy2D create a window for you.

Safety

While a GLRenderer object is active, you must not make any changes to the active GL context. Doing so may lead to undefined behavior, which is why this function is marked unsafe. It is strongly advised not to use any other OpenGL libraries in the same thread as GLRenderer

pub fn set_viewport_size_pixels(&mut self, viewport_size_pixels: Vector2<u32>)[src]

Sets the renderer viewport to the specified pixel size, in response to a change in the window size.

pub fn create_image_from_raw_pixels(
    &mut self,
    data_type: ImageDataType,
    smoothing_mode: ImageSmoothingMode,
    size: Vector2<u32>,
    data: &[u8]
) -> Result<ImageHandle, BacktraceError<ErrorMessage>>
[src]

Creates a new ImageHandle from the specified raw pixel data.

The data provided in the data parameter must be in the format specified by data_type.

The returned ImageHandle is valid only for the current graphics context.

pub fn draw_frame<F: FnOnce(&mut Graphics2D) -> R, R>(
    &mut self,
    callback: F
) -> R
[src]

Starts the process of drawing a frame. A Graphics2D object will be provided to the callback. When the callback returns, the internal render queue will be flushed.

Note: if calling this method, you are responsible for swapping the window context buffers if necessary.

Trait Implementations

impl Drop for GLRenderer[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.