pub trait NotCurrentGlContext: Sealed {
type PossiblyCurrentContext: PossiblyCurrentGlContext;
type Surface<T: SurfaceTypeTrait>: GlSurface<T>;
// Required methods
fn treat_as_possibly_current(self) -> Self::PossiblyCurrentContext;
fn make_current<T: SurfaceTypeTrait>(
self,
surface: &Self::Surface<T>,
) -> Result<Self::PossiblyCurrentContext>;
fn make_current_draw_read<T: SurfaceTypeTrait>(
self,
surface_draw: &Self::Surface<T>,
surface_read: &Self::Surface<T>,
) -> Result<Self::PossiblyCurrentContext>;
}
Expand description
A trait to group common not current operations.
Required Associated Types§
Sourcetype PossiblyCurrentContext: PossiblyCurrentGlContext
type PossiblyCurrentContext: PossiblyCurrentGlContext
The type of possibly current context.
Sourcetype Surface<T: SurfaceTypeTrait>: GlSurface<T>
type Surface<T: SurfaceTypeTrait>: GlSurface<T>
The surface supported by the context.
Required Methods§
Sourcefn treat_as_possibly_current(self) -> Self::PossiblyCurrentContext
fn treat_as_possibly_current(self) -> Self::PossiblyCurrentContext
Treat the not current context as possibly current. The operation is safe because the possibly current context is more restricted and not guaranteed to be current.
Sourcefn make_current<T: SurfaceTypeTrait>(
self,
surface: &Self::Surface<T>,
) -> Result<Self::PossiblyCurrentContext>
fn make_current<T: SurfaceTypeTrait>( self, surface: &Self::Surface<T>, ) -> Result<Self::PossiblyCurrentContext>
Make Self::Surface
on the calling thread producing the
Self::PossiblyCurrentContext
indicating that the context could
be current on the thread.
§Platform specific
- macOS: this will block if your main thread is blocked;
- Wayland: this call may latch the underlying back buffer (will do
with mesa drivers), meaning that all resize operations will apply
after the next
GlSurface::swap_buffers
.
Sourcefn make_current_draw_read<T: SurfaceTypeTrait>(
self,
surface_draw: &Self::Surface<T>,
surface_read: &Self::Surface<T>,
) -> Result<Self::PossiblyCurrentContext>
fn make_current_draw_read<T: SurfaceTypeTrait>( self, surface_draw: &Self::Surface<T>, surface_read: &Self::Surface<T>, ) -> Result<Self::PossiblyCurrentContext>
The same as Self::make_current
, but provides a way to set read and
draw surfaces.
§Api-specific:
- WGL/CGL: not supported.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.