pub struct ContextBuilder<'a> {
pub gl_attr: GlAttributes<&'a Context>,
/* private fields */
}
Expand description
Object that allows you to build Context
s.
Fields§
§gl_attr: GlAttributes<&'a Context>
The attributes to use to create the context.
Implementations§
Source§impl<'a> ContextBuilder<'a>
impl<'a> ContextBuilder<'a>
Sourcepub fn new() -> ContextBuilder<'a>
pub fn new() -> ContextBuilder<'a>
Initializes a new ContextBuilder
with default values.
Sourcepub fn with_gl(self, request: GlRequest) -> ContextBuilder<'a>
pub fn with_gl(self, request: GlRequest) -> ContextBuilder<'a>
Sets how the backend should choose the OpenGL API and version.
Sourcepub fn with_gl_profile(self, profile: GlProfile) -> ContextBuilder<'a>
pub fn with_gl_profile(self, profile: GlProfile) -> ContextBuilder<'a>
Sets the desired OpenGL context profile.
Sourcepub fn with_gl_debug_flag(self, flag: bool) -> ContextBuilder<'a>
pub fn with_gl_debug_flag(self, flag: bool) -> ContextBuilder<'a>
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
.
Sourcepub fn with_gl_robustness(self, robustness: Robustness) -> ContextBuilder<'a>
pub fn with_gl_robustness(self, robustness: Robustness) -> ContextBuilder<'a>
Sets the robustness of the OpenGL context. See the docs of Robustness
.
Sourcepub fn with_vsync(self, vsync: bool) -> ContextBuilder<'a>
pub fn with_vsync(self, vsync: bool) -> ContextBuilder<'a>
Requests that the window has vsync enabled.
By default, vsync is not enabled.
Share the display lists with the given Context
.
Sourcepub fn with_multisampling(self, samples: u16) -> ContextBuilder<'a>
pub fn with_multisampling(self, samples: u16) -> ContextBuilder<'a>
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.
Sourcepub fn with_depth_buffer(self, bits: u8) -> ContextBuilder<'a>
pub fn with_depth_buffer(self, bits: u8) -> ContextBuilder<'a>
Sets the number of bits in the depth buffer.
Sourcepub fn with_stencil_buffer(self, bits: u8) -> ContextBuilder<'a>
pub fn with_stencil_buffer(self, bits: u8) -> ContextBuilder<'a>
Sets the number of bits in the stencil buffer.
Sourcepub fn with_pixel_format(
self,
color_bits: u8,
alpha_bits: u8,
) -> ContextBuilder<'a>
pub fn with_pixel_format( self, color_bits: u8, alpha_bits: u8, ) -> ContextBuilder<'a>
Sets the number of bits in the color buffer.
Sourcepub fn with_stereoscopy(self) -> ContextBuilder<'a>
pub fn with_stereoscopy(self) -> ContextBuilder<'a>
Request the backend to be stereoscopic.
Sourcepub fn with_srgb(self, srgb_enabled: bool) -> ContextBuilder<'a>
pub fn with_srgb(self, srgb_enabled: bool) -> ContextBuilder<'a>
Sets whether sRGB should be enabled on the window.
The default value is false
.
Auto Trait Implementations§
impl<'a> Freeze for ContextBuilder<'a>
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> SetParameter for T
impl<T> SetParameter for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self
from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self
is actually part of its subset T
(and can be converted to it).Source§unsafe fn to_subset_unchecked(&self) -> SS
unsafe fn to_subset_unchecked(&self) -> SS
self.to_subset
but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self
to the equivalent element of its superset.