Struct glutin::GlAttributes
source · [−]pub struct GlAttributes<S> {
pub sharing: Option<S>,
pub version: GlRequest,
pub profile: Option<GlProfile>,
pub debug: bool,
pub robustness: Robustness,
pub vsync: bool,
}
Expand description
Attributes to use when creating an OpenGL Context
.
Fields
sharing: Option<S>
An existing context with which some OpenGL objects get shared.
The default is None
.
version: GlRequest
Version to try create. See GlRequest
for more infos.
The default is GlRequest::Latest
.
profile: Option<GlProfile>
OpenGL profile to use.
The default is None
.
debug: bool
Whether to enable the debug
flag of the context.
Debug contexts are usually slower but give better error reporting.
The default is true
in debug mode and false
in release mode.
robustness: Robustness
How the OpenGL Context
should detect errors.
The default is NotRobust
because this is what is typically expected
when you create an OpenGL Context
. However for safety you should
consider Robustness::TryRobustLoseContextOnReset
.
vsync: bool
Whether to use vsync. If vsync is enabled, calling
ContextWrapper::swap_buffers()
will block until the screen refreshes.
This is typically used to prevent screen tearing.
The default is false
.
Implementations
sourceimpl<S> GlAttributes<S>
impl<S> GlAttributes<S>
sourcepub fn map_sharing<F, T>(self, f: F) -> GlAttributes<T>where
F: FnOnce(S) -> T,
pub fn map_sharing<F, T>(self, f: F) -> GlAttributes<T>where
F: FnOnce(S) -> T,
Turns the sharing
parameter into another type by calling a closure.
Trait Implementations
sourceimpl<S: Clone> Clone for GlAttributes<S>
impl<S: Clone> Clone for GlAttributes<S>
sourcefn clone(&self) -> GlAttributes<S>
fn clone(&self) -> GlAttributes<S>
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more