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§
sourcetype SurfaceType: SurfaceTypeTrait
type SurfaceType: SurfaceTypeTrait
The type of the surface.
sourcetype Context: PossiblyCurrentGlContext
type Context: PossiblyCurrentGlContext
The context to access surface data.
Required Methods§
sourcefn buffer_age(&self) -> u32
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.
sourcefn height(&self) -> Option<u32>
fn height(&self) -> Option<u32>
The physical height of the underlying surface.
Platform specific
macOS: - This will block if your main thread is blocked.
sourcefn is_single_buffered(&self) -> bool
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.
sourcefn swap_buffers(&self, context: &Self::Context) -> Result<()>
fn swap_buffers(&self, context: &Self::Context) -> Result<()>
Swaps the underlying back buffers when the surface is not single buffered.
sourcefn is_current(&self, context: &Self::Context) -> bool
fn is_current(&self, context: &Self::Context) -> bool
Check whether the surface is current on to the current thread.
sourcefn is_current_draw(&self, context: &Self::Context) -> bool
fn is_current_draw(&self, context: &Self::Context) -> bool
Check whether the surface is the current draw surface to the current thread.
sourcefn is_current_read(&self, context: &Self::Context) -> bool
fn is_current_read(&self, context: &Self::Context) -> bool
Check whether the surface is the current read surface to the current thread.
sourcefn set_swap_interval(
&self,
context: &Self::Context,
interval: SwapInterval
) -> Result<()>
fn set_swap_interval( &self, context: &Self::Context, interval: SwapInterval ) -> Result<()>
Set swap interval for the surface.
See crate::surface::SwapInterval
for details.
sourcefn resize(&self, context: &Self::Context, width: NonZeroU32, height: NonZeroU32)where
Self::SurfaceType: ResizeableSurface,
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>
impl<T: SurfaceTypeTrait> GlSurface<T> for glutin::surface::Surface<T>
type Context = PossiblyCurrentContext
type SurfaceType = T
source§impl<T: SurfaceTypeTrait> GlSurface<T> for glutin::api::egl::surface::Surface<T>
Available on egl_backend
only.
impl<T: SurfaceTypeTrait> GlSurface<T> for glutin::api::egl::surface::Surface<T>
egl_backend
only.type Context = PossiblyCurrentContext
type SurfaceType = T
source§impl<T: SurfaceTypeTrait> GlSurface<T> for glutin::api::wgl::surface::Surface<T>
Available on wgl_backend
only.
impl<T: SurfaceTypeTrait> GlSurface<T> for glutin::api::wgl::surface::Surface<T>
wgl_backend
only.