Trait glutin::surface::GlSurface

source ·
pub trait GlSurface<T: SurfaceTypeTrait>: Sealed {
    type SurfaceType: SurfaceTypeTrait;
    type Context: PossiblyCurrentGlContext;

    // Required methods
    fn buffer_age(&self) -> u32;
    fn width(&self) -> Option<u32>;
    fn height(&self) -> Option<u32>;
    fn is_single_buffered(&self) -> bool;
    fn swap_buffers(&self, context: &Self::Context) -> Result<()>;
    fn is_current(&self, context: &Self::Context) -> bool;
    fn is_current_draw(&self, context: &Self::Context) -> bool;
    fn is_current_read(&self, context: &Self::Context) -> bool;
    fn set_swap_interval(
        &self,
        context: &Self::Context,
        interval: SwapInterval
    ) -> Result<()>;
    fn resize(
        &self,
        context: &Self::Context,
        width: NonZeroU32,
        height: NonZeroU32
    )
       where Self::SurfaceType: ResizeableSurface;
}
Expand description

A trait to group common operations on the surface.

Required Associated Types§

source

type SurfaceType: SurfaceTypeTrait

The type of the surface.

source

type Context: PossiblyCurrentGlContext

The context to access surface data.

Required Methods§

source

fn buffer_age(&self) -> u32

The age of the back buffer of that surface. The 0 indicates that the buffer is either a new one or we failed to get the information about its age. In both cases you must redraw the entire buffer.

source

fn width(&self) -> Option<u32>

The physical width of the underlying surface.

source

fn height(&self) -> Option<u32>

The physical height of the underlying surface.

Platform specific

macOS: - This will block if your main thread is blocked.

source

fn is_single_buffered(&self) -> bool

Check whether the surface is single buffered.

Platform specific

macOS: - This will block if your main thread is blocked.

source

fn swap_buffers(&self, context: &Self::Context) -> Result<()>

Swaps the underlying back buffers when the surface is not single buffered.

source

fn is_current(&self, context: &Self::Context) -> bool

Check whether the surface is current on to the current thread.

source

fn is_current_draw(&self, context: &Self::Context) -> bool

Check whether the surface is the current draw surface to the current thread.

source

fn is_current_read(&self, context: &Self::Context) -> bool

Check whether the surface is the current read surface to the current thread.

source

fn set_swap_interval( &self, context: &Self::Context, interval: SwapInterval ) -> Result<()>

Set swap interval for the surface.

See crate::surface::SwapInterval for details.

source

fn resize(&self, context: &Self::Context, width: NonZeroU32, height: NonZeroU32)where Self::SurfaceType: ResizeableSurface,

Resize the surface to a new size.

This call is for compatibility reasons, on most platforms it’s a no-op.

Platform specific

Wayland: - resizes the surface. macOS: - This will block if your main thread is blocked. Other: - no op.

Implementors§

source§

impl<T: SurfaceTypeTrait> GlSurface<T> for glutin::surface::Surface<T>

source§

impl<T: SurfaceTypeTrait> GlSurface<T> for glutin::api::egl::surface::Surface<T>

Available on egl_backend only.
source§

impl<T: SurfaceTypeTrait> GlSurface<T> for glutin::api::glx::surface::Surface<T>

Available on glx_backend only.