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.
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
Share the display lists with the given context.
To get sharing working it’s recommended to use the same Config
when
creating contexts that are going to be shared.
Platform-specific
On Wayland both contexts must use the same Wayland connection.
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
Set the desired OpenGL context profile. See the docs of GlProfile
.
By default the profile is unspecified.
Api-specific
macOS: - not supported, the latest is picked automatically.
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 raw_window_handle
for if you plan to use it
with 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