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§

source

type PossiblyCurrentContext: PossiblyCurrentGlContext

The type of possibly current context.

source

type Surface<T: SurfaceTypeTrait>: GlSurface<T>

The surface supported by the context.

Required Methods§

source

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.

source

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 theard.

§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.
source

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.

Object Safety§

This trait is not object safe.

Implementors§