Struct glutin::context::ContextAttributesBuilder
source · pub struct ContextAttributesBuilder { /* private fields */ }
Expand description
The builder to help customizing context
Implementations§
source§impl ContextAttributesBuilder
impl ContextAttributesBuilder
sourcepub fn with_debug(self, debug: bool) -> Self
pub fn with_debug(self, debug: bool) -> Self
Sets the debug flag for the OpenGL context.
Debug contexts are usually slower, but give better error reporting.
This option is ignored when using Robustness::NoError
.
The default value for this flag is false
.
sourcepub fn with_sharing(self, context: &impl AsRawContext) -> Self
pub fn with_sharing(self, context: &impl AsRawContext) -> Self
sourcepub fn with_robustness(self, robustness: Robustness) -> Self
pub fn with_robustness(self, robustness: Robustness) -> Self
Sets the robustness of the OpenGL context. See the docs of
Robustness
.
The default is Robustness::NotRobust
, because this is what typically
expected when you create an OpenGL context. However for safety you
should consider Robustness::RobustLoseContextOnReset
.
sourcepub fn with_release_behavior(self, release_behavior: ReleaseBehavior) -> Self
pub fn with_release_behavior(self, release_behavior: ReleaseBehavior) -> Self
The behavior when changing the current context. See the docs of
ReleaseBehavior
.
The default is ReleaseBehavior::Flush
.
sourcepub fn with_profile(self, profile: GlProfile) -> Self
pub fn with_profile(self, profile: GlProfile) -> Self
sourcepub fn with_context_api(self, api: ContextApi) -> Self
pub fn with_context_api(self, api: ContextApi) -> Self
Set the desired OpenGL context api. See the docs of ContextApi
.
By default the supported api will be picked.
sourcepub fn build(
self,
raw_window_handle: Option<RawWindowHandle>
) -> ContextAttributes
pub fn build( self, raw_window_handle: Option<RawWindowHandle> ) -> ContextAttributes
Build the context attributes.
The raw_window_handle
isn’t required and here for WGL compatibility.
§Api-specific
- WGL: you must pass a
raw_window_handle
if you plan to use this context with that window.
Trait Implementations§
source§impl Clone for ContextAttributesBuilder
impl Clone for ContextAttributesBuilder
source§fn clone(&self) -> ContextAttributesBuilder
fn clone(&self) -> ContextAttributesBuilder
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more