pub struct Context { /* private fields */ }
Expand description
Represents an OpenGL context.
A Context
is normally associated with a single Window, however Context
s
can be shared between multiple windows or be headless.
Example
let cb = glutin::ContextBuilder::new()
.with_vsync(true)
.with_multisampling(8)
.with_shared_lists(some_context.context());
Implementations§
source§impl Context
impl Context
sourcepub fn new_headless(
el: &EventsLoop,
cb: ContextBuilder<'_>,
dims: PhysicalSize
) -> Result<Self, CreationError>
pub fn new_headless( el: &EventsLoop, cb: ContextBuilder<'_>, dims: PhysicalSize ) -> Result<Self, CreationError>
Builds the given GL context.
One notable limitation of the Wayland backend when it comes to shared contexts is that both contexts must use the same events loop.
Errors can occur in two scenarios:
- If the window could not be created (via permission denied, incompatible system, out of memory, etc.). This should be very rare.
- If the OpenGL context could not be created. This generally happens because the underlying platform doesn’t support a requested feature.
Trait Implementations§
source§impl ContextTrait for Context
impl ContextTrait for Context
source§unsafe fn make_current(&self) -> Result<(), ContextError>
unsafe fn make_current(&self) -> Result<(), ContextError>
Sets the context as the current context.
source§fn is_current(&self) -> bool
fn is_current(&self) -> bool
Returns true if this context is the current one in this thread.
source§impl ContextTraitExt for Context
impl ContextTraitExt for Context
source§impl RawContextExt for Context
impl RawContextExt for Context
source§unsafe fn new_raw_context(
hwnd: *mut c_void,
cb: ContextBuilder<'_>
) -> Result<RawContext, CreationError>where
Self: Sized,
unsafe fn new_raw_context( hwnd: *mut c_void, cb: ContextBuilder<'_> ) -> Result<RawContext, CreationError>where Self: Sized,
Creates a raw context on the provided window. Read more
Auto Trait Implementations§
impl !RefUnwindSafe for Context
impl Send for Context
impl Sync for Context
impl Unpin for Context
impl UnwindSafe for Context
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more