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 with_priority(self, priority: Priority) -> Self
pub fn with_priority(self, priority: Priority) -> Self
Set the priority hint, which might not be honored if the API does not support it, if there are constraints on the number of high priority contexts available in the system, or system policy limits access to high priority contexts to appropriate system privilege level the context creation may fail.
By default no priority is specified, which corresponds to
Priority::Medium
.
§Api specific
- WGL/GLX: not implemented.
- CGL: not supported.
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