Struct GLAttr
pub struct GLAttr<'a> { /* private fields */ }
dep_sdl3
only.Expand description
OpenGL context getters and setters. Obtain with VideoSubsystem::gl_attr()
.
Implementations§
§impl GLAttr<'_>
impl GLAttr<'_>
pub fn set_red_size(&self, value: u8)
pub fn set_red_size(&self, value: u8)
Sets the attribute: the minimum number of bits for the red channel of the color buffer; defaults to 3
pub fn red_size(&self) -> u8
pub fn red_size(&self) -> u8
Gets the attribute: the minimum number of bits for the red channel of the color buffer; defaults to 3
pub fn set_green_size(&self, value: u8)
pub fn set_green_size(&self, value: u8)
Sets the attribute: the minimum number of bits for the green channel of the color buffer; defaults to 3
pub fn green_size(&self) -> u8
pub fn green_size(&self) -> u8
Gets the attribute: the minimum number of bits for the green channel of the color buffer; defaults to 3
pub fn set_blue_size(&self, value: u8)
pub fn set_blue_size(&self, value: u8)
Sets the attribute: the minimum number of bits for the blue channel of the color buffer; defaults to 2
pub fn blue_size(&self) -> u8
pub fn blue_size(&self) -> u8
Gets the attribute: the minimum number of bits for the blue channel of the color buffer; defaults to 2
pub fn set_alpha_size(&self, value: u8)
pub fn set_alpha_size(&self, value: u8)
Sets the attribute: the minimum number of bits for the alpha channel of the color buffer; defaults to 0
pub fn alpha_size(&self) -> u8
pub fn alpha_size(&self) -> u8
Gets the attribute: the minimum number of bits for the alpha channel of the color buffer; defaults to 0
pub fn set_buffer_size(&self, value: u8)
pub fn set_buffer_size(&self, value: u8)
Sets the attribute: the minimum number of bits for frame buffer size; defaults to 0
pub fn buffer_size(&self) -> u8
pub fn buffer_size(&self) -> u8
Gets the attribute: the minimum number of bits for frame buffer size; defaults to 0
pub fn set_double_buffer(&self, value: bool)
pub fn set_double_buffer(&self, value: bool)
Sets the attribute: whether the output is single or double buffered; defaults to double buffering on
pub fn double_buffer(&self) -> bool
pub fn double_buffer(&self) -> bool
Gets the attribute: whether the output is single or double buffered; defaults to double buffering on
pub fn set_depth_size(&self, value: u8)
pub fn set_depth_size(&self, value: u8)
Sets the attribute: the minimum number of bits in the depth buffer; defaults to 16
pub fn depth_size(&self) -> u8
pub fn depth_size(&self) -> u8
Gets the attribute: the minimum number of bits in the depth buffer; defaults to 16
pub fn set_stencil_size(&self, value: u8)
pub fn set_stencil_size(&self, value: u8)
Sets the attribute: the minimum number of bits in the stencil buffer; defaults to 0
pub fn stencil_size(&self) -> u8
pub fn stencil_size(&self) -> u8
Gets the attribute: the minimum number of bits in the stencil buffer; defaults to 0
pub fn set_accum_red_size(&self, value: u8)
pub fn set_accum_red_size(&self, value: u8)
Sets the attribute: the minimum number of bits for the red channel of the accumulation buffer; defaults to 0
pub fn accum_red_size(&self) -> u8
pub fn accum_red_size(&self) -> u8
Gets the attribute: the minimum number of bits for the red channel of the accumulation buffer; defaults to 0
pub fn set_accum_green_size(&self, value: u8)
pub fn set_accum_green_size(&self, value: u8)
Sets the attribute: the minimum number of bits for the green channel of the accumulation buffer; defaults to 0
pub fn accum_green_size(&self) -> u8
pub fn accum_green_size(&self) -> u8
Gets the attribute: the minimum number of bits for the green channel of the accumulation buffer; defaults to 0
pub fn set_accum_blue_size(&self, value: u8)
pub fn set_accum_blue_size(&self, value: u8)
Sets the attribute: the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0
pub fn accum_blue_size(&self) -> u8
pub fn accum_blue_size(&self) -> u8
Gets the attribute: the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0
pub fn set_accum_alpha_size(&self, value: u8)
pub fn set_accum_alpha_size(&self, value: u8)
Sets the attribute: the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0
pub fn accum_alpha_size(&self) -> u8
pub fn accum_alpha_size(&self) -> u8
Gets the attribute: the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0
pub fn set_stereo(&self, value: bool)
pub fn set_stereo(&self, value: bool)
Sets the attribute: whether the output is stereo 3D; defaults to off
pub fn set_multisample_buffers(&self, value: u8)
pub fn set_multisample_buffers(&self, value: u8)
Sets the attribute: the number of buffers used for multisample anti-aliasing; defaults to 0
pub fn multisample_buffers(&self) -> u8
pub fn multisample_buffers(&self) -> u8
Gets the attribute: the number of buffers used for multisample anti-aliasing; defaults to 0
pub fn set_multisample_samples(&self, value: u8)
pub fn set_multisample_samples(&self, value: u8)
Sets the attribute: the number of samples used around the current pixel used for multisample anti-aliasing; defaults to 0
pub fn multisample_samples(&self) -> u8
pub fn multisample_samples(&self) -> u8
Gets the attribute: the number of samples used around the current pixel used for multisample anti-aliasing; defaults to 0
pub fn set_accelerated_visual(&self, value: bool)
pub fn set_accelerated_visual(&self, value: bool)
Sets the attribute: whether to require hardware acceleration; false to force software rendering; defaults to allow either
pub fn accelerated_visual(&self) -> bool
pub fn accelerated_visual(&self) -> bool
Gets the attribute: whether to require hardware acceleration; false to force software rendering; defaults to allow either
pub fn set_context_major_version(&self, value: u8)
pub fn set_context_major_version(&self, value: u8)
Sets the attribute: OpenGL context major version
pub fn context_major_version(&self) -> u8
pub fn context_major_version(&self) -> u8
Gets the attribute: OpenGL context major version
pub fn set_context_minor_version(&self, value: u8)
pub fn set_context_minor_version(&self, value: u8)
Sets the attribute: OpenGL context minor version
pub fn context_minor_version(&self) -> u8
pub fn context_minor_version(&self) -> u8
Gets the attribute: OpenGL context minor version
pub fn set_context_profile(&self, value: GLProfile)
pub fn set_context_profile(&self, value: GLProfile)
Sets the attribute: type of GL context (Core, Compatibility, ES)
pub fn context_profile(&self) -> GLProfile
pub fn context_profile(&self) -> GLProfile
Gets the attribute: type of GL context (Core, Compatibility, ES)
Sets the attribute: OpenGL context sharing; defaults to false
Gets the attribute: OpenGL context sharing; defaults to false
pub fn set_framebuffer_srgb_compatible(&self, value: bool)
pub fn set_framebuffer_srgb_compatible(&self, value: bool)
Sets the attribute: requests sRGB capable visual; defaults to false (>= SDL 2.0.1)
pub fn framebuffer_srgb_compatible(&self) -> bool
pub fn framebuffer_srgb_compatible(&self) -> bool
Gets the attribute: requests sRGB capable visual; defaults to false (>= SDL 2.0.1)
pub fn set_context_no_error(&self, value: bool)
pub fn set_context_no_error(&self, value: bool)
Sets the attribute: disables OpenGL error checking; defaults to false (>= SDL 2.0.6)
pub fn context_no_error(&self) -> bool
pub fn context_no_error(&self) -> bool
Gets the attribute: disables OpenGL error checking; defaults to false (>= SDL 2.0.6)
pub fn set_context_version(&self, major: u8, minor: u8)
pub fn set_context_version(&self, major: u8, minor: u8)
Sets the OpenGL context major and minor versions.
pub fn context_version(&self) -> (u8, u8) ⓘ
pub fn context_version(&self) -> (u8, u8) ⓘ
Gets the OpenGL context major and minor versions as a tuple.
§impl GLAttr<'_>
impl GLAttr<'_>
pub fn set_context_flags(&self) -> ContextFlagsBuilder<'_>
pub fn set_context_flags(&self) -> ContextFlagsBuilder<'_>
Sets any combination of OpenGL context configuration flags.
Note that calling this will reset any existing context flags.
§Example
let sdl_context = sdl3::init().unwrap();
let video_subsystem = sdl_context.video().unwrap();
let gl_attr = video_subsystem.gl_attr();
// Sets the GL context into debug mode.
gl_attr.set_context_flags().debug().set();
pub fn context_flags(&self) -> ContextFlags
pub fn context_flags(&self) -> ContextFlags
Gets the applied OpenGL context configuration flags.
§Example
let sdl_context = sdl3::init().unwrap();
let video_subsystem = sdl_context.video().unwrap();
let gl_attr = video_subsystem.gl_attr();
// Is the GL context in debug mode?
if gl_attr.context_flags().has_debug() {
println!("Debug mode");
}
Auto Trait Implementations§
impl<'a> Freeze for GLAttr<'a>
impl<'a> RefUnwindSafe for GLAttr<'a>
impl<'a> !Send for GLAttr<'a>
impl<'a> !Sync for GLAttr<'a>
impl<'a> Unpin for GLAttr<'a>
impl<'a> UnwindSafe for GLAttr<'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> ByteSized for T
impl<T> ByteSized for T
Source§const BYTE_ALIGN: usize = _
const BYTE_ALIGN: usize = _
Source§fn byte_align(&self) -> usize
fn byte_align(&self) -> usize
Source§fn ptr_size_ratio(&self) -> [usize; 2]
fn ptr_size_ratio(&self) -> [usize; 2]
Source§impl<T, R> Chain<R> for Twhere
T: ?Sized,
impl<T, R> Chain<R> for Twhere
T: ?Sized,
Source§impl<T> ExtAny for T
impl<T> ExtAny for T
Source§fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
fn type_hash_with<H: Hasher>(&self, hasher: H) -> u64
TypeId
of Self
using a custom hasher.Source§fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
fn as_any_mut(&mut self) -> &mut dyn Anywhere
Self: Sized,
Source§impl<T> ExtMem for Twhere
T: ?Sized,
impl<T> ExtMem for Twhere
T: ?Sized,
Source§const NEEDS_DROP: bool = _
const NEEDS_DROP: bool = _
Source§fn mem_align_of<T>() -> usize
fn mem_align_of<T>() -> usize
Source§fn mem_align_of_val(&self) -> usize
fn mem_align_of_val(&self) -> usize
Source§fn mem_size_of<T>() -> usize
fn mem_size_of<T>() -> usize
Source§fn mem_size_of_val(&self) -> usize
fn mem_size_of_val(&self) -> usize
Source§fn mem_needs_drop(&self) -> bool
fn mem_needs_drop(&self) -> bool
true
if dropping values of this type matters. Read moreSource§fn mem_forget(self)where
Self: Sized,
fn mem_forget(self)where
Self: Sized,
self
without running its destructor. Read moreSource§fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
fn mem_replace(&mut self, other: Self) -> Selfwhere
Self: Sized,
Source§unsafe fn mem_zeroed<T>() -> T
unsafe fn mem_zeroed<T>() -> T
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe fn mem_transmute_copy<Src, Dst>(src: &Src) -> Dst
unsafe_layout
only.T
represented by the all-zero byte-pattern. Read moreSource§fn mem_as_bytes(&self) -> &[u8] ⓘ
fn mem_as_bytes(&self) -> &[u8] ⓘ
unsafe_slice
only.§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Hook for T
impl<T> Hook for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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 more