pub struct ContextAttributesBuilder { /* private fields */ }
Expand description

The builder to help customizing context

Implementations§

source§

impl ContextAttributesBuilder

source

pub fn new() -> Self

Create new builder.

source

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.

source

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
  • Wayland: both contexts must use the same Wayland connection.
source

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.

source

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.

source

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.
source

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.

source

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

source§

fn clone(&self) -> ContextAttributesBuilder

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for ContextAttributesBuilder

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for ContextAttributesBuilder

source§

fn default() -> ContextAttributesBuilder

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> AutoreleaseSafe for T
where T: ?Sized,