glutin::context

Struct ContextAttributesBuilder

Source
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 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.
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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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,

Source§

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>,

Source§

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>,

Source§

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.