pub trait PossiblyCurrentGlContext: Sealed {
type NotCurrentContext: NotCurrentGlContext;
type Surface<T: SurfaceTypeTrait>: GlSurface<T>;
// Required methods
fn is_current(&self) -> bool;
fn make_not_current(self) -> Result<Self::NotCurrentContext>;
fn make_not_current_in_place(&self) -> Result<()>;
fn make_current<T: SurfaceTypeTrait>(
&self,
surface: &Self::Surface<T>,
) -> Result<()>;
fn make_current_draw_read<T: SurfaceTypeTrait>(
&self,
surface_draw: &Self::Surface<T>,
surface_read: &Self::Surface<T>,
) -> Result<()>;
}
Expand description
A trait to group common context operations.
Required Associated Types§
Sourcetype NotCurrentContext: NotCurrentGlContext
type NotCurrentContext: NotCurrentGlContext
The not current context type.
Sourcetype Surface<T: SurfaceTypeTrait>: GlSurface<T>
type Surface<T: SurfaceTypeTrait>: GlSurface<T>
The surface supported by the context.
Required Methods§
Sourcefn is_current(&self) -> bool
fn is_current(&self) -> bool
Returns true
if this context is the current one in this thread.
Sourcefn make_not_current(self) -> Result<Self::NotCurrentContext>
fn make_not_current(self) -> Result<Self::NotCurrentContext>
Make the context not current to the current thread and returns a
Self::NotCurrentContext
to indicate that the context is a not
current to allow sending it to the different thread.
§Platform specific
- macOS: this will block if your main thread is blocked.
Sourcefn make_not_current_in_place(&self) -> Result<()>
fn make_not_current_in_place(&self) -> Result<()>
Make the context not current to the current thread. If you need to
send the context to another thread, use Self::make_not_current
instead.
Sourcefn make_current<T: SurfaceTypeTrait>(
&self,
surface: &Self::Surface<T>,
) -> Result<()>
fn make_current<T: SurfaceTypeTrait>( &self, surface: &Self::Surface<T>, ) -> Result<()>
Make Self::Surface
current on the calling thread.
§Platform specific
- macOS: this will block if your main thread is blocked.
Sourcefn make_current_draw_read<T: SurfaceTypeTrait>(
&self,
surface_draw: &Self::Surface<T>,
surface_read: &Self::Surface<T>,
) -> Result<()>
fn make_current_draw_read<T: SurfaceTypeTrait>( &self, surface_draw: &Self::Surface<T>, surface_read: &Self::Surface<T>, ) -> Result<()>
The same as Self::make_current
but provides a way to set read and
draw surfaces explicitly.
§Api-specific:
- CGL/WGL: 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.