Struct glutin::ContextBuilder

source ·
pub struct ContextBuilder<'a> {
    pub gl_attr: GlAttributes<&'a Context>,
    /* private fields */
}
Expand description

Object that allows you to build Contexts.

Fields§

§gl_attr: GlAttributes<&'a Context>

The attributes to use to create the context.

Implementations§

source§

impl<'a> ContextBuilder<'a>

source

pub fn new() -> Self

Initializes a new ContextBuilder with default values.

source

pub fn with_gl(self, request: GlRequest) -> Self

Sets how the backend should choose the OpenGL API and version.

source

pub fn with_gl_profile(self, profile: GlProfile) -> Self

Sets the desired OpenGL context profile.

source

pub fn with_gl_debug_flag(self, flag: bool) -> Self

Sets the debug flag for the OpenGL context.

The default value for this flag is cfg!(debug_assertions), which means that it’s enabled when you run cargo build and disabled when you run cargo build --release.

source

pub fn with_gl_robustness(self, robustness: Robustness) -> Self

Sets the robustness of the OpenGL context. See the docs of Robustness.

source

pub fn with_vsync(self, vsync: bool) -> Self

Requests that the window has vsync enabled.

By default, vsync is not enabled.

source

pub fn with_shared_lists(self, other: &'a Context) -> Self

Share the display lists with the given Context.

source

pub fn with_multisampling(self, samples: u16) -> Self

Sets the multisampling level to request. A value of 0 indicates that multisampling must not be enabled.

Panic

Will panic if samples is not a power of two.

source

pub fn with_depth_buffer(self, bits: u8) -> Self

Sets the number of bits in the depth buffer.

source

pub fn with_stencil_buffer(self, bits: u8) -> Self

Sets the number of bits in the stencil buffer.

source

pub fn with_pixel_format(self, color_bits: u8, alpha_bits: u8) -> Self

Sets the number of bits in the color buffer.

source

pub fn with_stereoscopy(self) -> Self

Request the backend to be stereoscopic.

source

pub fn with_srgb(self, srgb_enabled: bool) -> Self

Sets whether sRGB should be enabled on the window.

The default value is false.

source

pub fn with_double_buffer(self, double_buffer: Option<bool>) -> Self

Sets whether double buffering should be enabled.

The default value is None.

Platform-specific

This option will be taken into account on the following platforms:

  • MacOS
  • Linux using GLX with X
  • Windows using WGL
source

pub fn with_hardware_acceleration(self, acceleration: Option<bool>) -> Self

Sets whether hardware acceleration is required.

The default value is Some(true)

Platform-specific

This option will be taken into account on the following platforms:

  • MacOS
  • Linux using EGL with either X or Wayland
  • Windows using EGL or WGL
  • Android using EGL

Auto Trait Implementations§

§

impl<'a> !RefUnwindSafe for ContextBuilder<'a>

§

impl<'a> Send for ContextBuilder<'a>

§

impl<'a> Sync for ContextBuilder<'a>

§

impl<'a> Unpin for ContextBuilder<'a>

§

impl<'a> !UnwindSafe for ContextBuilder<'a>

Blanket Implementations§

source§

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

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere 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 Twhere 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.

§

impl<T> Pointable for T

§

const ALIGN: usize = mem::align_of::<T>()

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
§

impl<T> SetParameter for T

§

fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Resultwhere T: Parameter<Self>,

Sets value as a parameter of self.
source§

impl<T, U> TryFrom<U> for Twhere 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 Twhere 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.
§

impl<T> Erased for T