Struct SDL_GLAttr
#[repr(transparent)]pub struct SDL_GLAttr(pub i32);
dep_sdl3
only.Expand description
An enumeration of OpenGL configuration attributes.
While you can set most OpenGL attributes normally, the attributes listed
above must be known before SDL creates the window that will be used with
the OpenGL context. These attributes are set and read with
SDL_GL_SetAttribute()
and SDL_GL_GetAttribute()
.
In some cases, these attributes are minimum requests; the GL does not promise to give you exactly what you asked for. It’s possible to ask for a 16-bit depth buffer and get a 24-bit one instead, for example, or to ask for no stencil buffer and still have one available. Context creation should fail if the GL can’t provide your requested attributes at a minimum, but you should check to see exactly what you got.
§Availability
This enum is available since SDL 3.2.0.
§Known values (sdl3-sys
)
Associated constant | Global constant | Description |
---|---|---|
RED_SIZE | SDL_GL_RED_SIZE | the minimum number of bits for the red channel of the color buffer; defaults to 3. |
GREEN_SIZE | SDL_GL_GREEN_SIZE | the minimum number of bits for the green channel of the color buffer; defaults to 3. |
BLUE_SIZE | SDL_GL_BLUE_SIZE | the minimum number of bits for the blue channel of the color buffer; defaults to 2. |
ALPHA_SIZE | SDL_GL_ALPHA_SIZE | the minimum number of bits for the alpha channel of the color buffer; defaults to 0. |
BUFFER_SIZE | SDL_GL_BUFFER_SIZE | the minimum number of bits for frame buffer size; defaults to 0. |
DOUBLEBUFFER | SDL_GL_DOUBLEBUFFER | whether the output is single or double buffered; defaults to double buffering on. |
DEPTH_SIZE | SDL_GL_DEPTH_SIZE | the minimum number of bits in the depth buffer; defaults to 16. |
STENCIL_SIZE | SDL_GL_STENCIL_SIZE | the minimum number of bits in the stencil buffer; defaults to 0. |
ACCUM_RED_SIZE | SDL_GL_ACCUM_RED_SIZE | the minimum number of bits for the red channel of the accumulation buffer; defaults to 0. |
ACCUM_GREEN_SIZE | SDL_GL_ACCUM_GREEN_SIZE | the minimum number of bits for the green channel of the accumulation buffer; defaults to 0. |
ACCUM_BLUE_SIZE | SDL_GL_ACCUM_BLUE_SIZE | the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0. |
ACCUM_ALPHA_SIZE | SDL_GL_ACCUM_ALPHA_SIZE | the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0. |
STEREO | SDL_GL_STEREO | whether the output is stereo 3D; defaults to off. |
MULTISAMPLEBUFFERS | SDL_GL_MULTISAMPLEBUFFERS | the number of buffers used for multisample anti-aliasing; defaults to 0. |
MULTISAMPLESAMPLES | SDL_GL_MULTISAMPLESAMPLES | the number of samples used around the current pixel used for multisample anti-aliasing. |
ACCELERATED_VISUAL | SDL_GL_ACCELERATED_VISUAL | set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either. |
RETAINED_BACKING | SDL_GL_RETAINED_BACKING | not used (deprecated). |
CONTEXT_MAJOR_VERSION | SDL_GL_CONTEXT_MAJOR_VERSION | OpenGL context major version. |
CONTEXT_MINOR_VERSION | SDL_GL_CONTEXT_MINOR_VERSION | OpenGL context minor version. |
CONTEXT_FLAGS | SDL_GL_CONTEXT_FLAGS | some combination of 0 or more of elements of the SDL_GLContextFlag enumeration; defaults to 0. |
CONTEXT_PROFILE_MASK | SDL_GL_CONTEXT_PROFILE_MASK | type of GL context (Core, Compatibility, ES). See SDL_GLProfile ; default value depends on platform. |
SHARE_WITH_CURRENT_CONTEXT | SDL_GL_SHARE_WITH_CURRENT_CONTEXT | OpenGL context sharing; defaults to 0. |
FRAMEBUFFER_SRGB_CAPABLE | SDL_GL_FRAMEBUFFER_SRGB_CAPABLE | requests sRGB capable visual; defaults to 0. |
CONTEXT_RELEASE_BEHAVIOR | SDL_GL_CONTEXT_RELEASE_BEHAVIOR | sets context the release behavior. See SDL_GLContextReleaseFlag ; defaults to FLUSH. |
CONTEXT_RESET_NOTIFICATION | SDL_GL_CONTEXT_RESET_NOTIFICATION | set context reset notification. See SDL_GLContextResetNotification ; defaults to NO_NOTIFICATION. |
CONTEXT_NO_ERROR | SDL_GL_CONTEXT_NO_ERROR | |
FLOATBUFFERS | SDL_GL_FLOATBUFFERS | |
EGL_PLATFORM | SDL_GL_EGL_PLATFORM |
Tuple Fields§
§0: i32
Implementations§
§impl SDL_GLAttr
impl SDL_GLAttr
pub const RED_SIZE: SDL_GLAttr
pub const RED_SIZE: SDL_GLAttr
the minimum number of bits for the red channel of the color buffer; defaults to 3.
pub const GREEN_SIZE: SDL_GLAttr
pub const GREEN_SIZE: SDL_GLAttr
the minimum number of bits for the green channel of the color buffer; defaults to 3.
pub const BLUE_SIZE: SDL_GLAttr
pub const BLUE_SIZE: SDL_GLAttr
the minimum number of bits for the blue channel of the color buffer; defaults to 2.
pub const ALPHA_SIZE: SDL_GLAttr
pub const ALPHA_SIZE: SDL_GLAttr
the minimum number of bits for the alpha channel of the color buffer; defaults to 0.
pub const BUFFER_SIZE: SDL_GLAttr
pub const BUFFER_SIZE: SDL_GLAttr
the minimum number of bits for frame buffer size; defaults to 0.
pub const DOUBLEBUFFER: SDL_GLAttr
pub const DOUBLEBUFFER: SDL_GLAttr
whether the output is single or double buffered; defaults to double buffering on.
pub const DEPTH_SIZE: SDL_GLAttr
pub const DEPTH_SIZE: SDL_GLAttr
the minimum number of bits in the depth buffer; defaults to 16.
pub const STENCIL_SIZE: SDL_GLAttr
pub const STENCIL_SIZE: SDL_GLAttr
the minimum number of bits in the stencil buffer; defaults to 0.
pub const ACCUM_RED_SIZE: SDL_GLAttr
pub const ACCUM_RED_SIZE: SDL_GLAttr
the minimum number of bits for the red channel of the accumulation buffer; defaults to 0.
pub const ACCUM_GREEN_SIZE: SDL_GLAttr
pub const ACCUM_GREEN_SIZE: SDL_GLAttr
the minimum number of bits for the green channel of the accumulation buffer; defaults to 0.
pub const ACCUM_BLUE_SIZE: SDL_GLAttr
pub const ACCUM_BLUE_SIZE: SDL_GLAttr
the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0.
pub const ACCUM_ALPHA_SIZE: SDL_GLAttr
pub const ACCUM_ALPHA_SIZE: SDL_GLAttr
the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0.
pub const STEREO: SDL_GLAttr
pub const STEREO: SDL_GLAttr
whether the output is stereo 3D; defaults to off.
pub const MULTISAMPLEBUFFERS: SDL_GLAttr
pub const MULTISAMPLEBUFFERS: SDL_GLAttr
the number of buffers used for multisample anti-aliasing; defaults to 0.
pub const MULTISAMPLESAMPLES: SDL_GLAttr
pub const MULTISAMPLESAMPLES: SDL_GLAttr
the number of samples used around the current pixel used for multisample anti-aliasing.
pub const ACCELERATED_VISUAL: SDL_GLAttr
pub const ACCELERATED_VISUAL: SDL_GLAttr
set to 1 to require hardware acceleration, set to 0 to force software rendering; defaults to allow either.
pub const RETAINED_BACKING: SDL_GLAttr
pub const RETAINED_BACKING: SDL_GLAttr
not used (deprecated).
pub const CONTEXT_MAJOR_VERSION: SDL_GLAttr
pub const CONTEXT_MAJOR_VERSION: SDL_GLAttr
OpenGL context major version.
pub const CONTEXT_MINOR_VERSION: SDL_GLAttr
pub const CONTEXT_MINOR_VERSION: SDL_GLAttr
OpenGL context minor version.
pub const CONTEXT_FLAGS: SDL_GLAttr
pub const CONTEXT_FLAGS: SDL_GLAttr
some combination of 0 or more of elements of the SDL_GLContextFlag
enumeration; defaults to 0.
pub const CONTEXT_PROFILE_MASK: SDL_GLAttr
pub const CONTEXT_PROFILE_MASK: SDL_GLAttr
type of GL context (Core, Compatibility, ES). See SDL_GLProfile
; default value depends on platform.
pub const SHARE_WITH_CURRENT_CONTEXT: SDL_GLAttr
pub const SHARE_WITH_CURRENT_CONTEXT: SDL_GLAttr
OpenGL context sharing; defaults to 0.
pub const FRAMEBUFFER_SRGB_CAPABLE: SDL_GLAttr
pub const FRAMEBUFFER_SRGB_CAPABLE: SDL_GLAttr
requests sRGB capable visual; defaults to 0.
pub const CONTEXT_RELEASE_BEHAVIOR: SDL_GLAttr
pub const CONTEXT_RELEASE_BEHAVIOR: SDL_GLAttr
sets context the release behavior. See SDL_GLContextReleaseFlag
; defaults to FLUSH.
pub const CONTEXT_RESET_NOTIFICATION: SDL_GLAttr
pub const CONTEXT_RESET_NOTIFICATION: SDL_GLAttr
set context reset notification. See SDL_GLContextResetNotification
; defaults to NO_NOTIFICATION.
pub const CONTEXT_NO_ERROR: SDL_GLAttr
pub const FLOATBUFFERS: SDL_GLAttr
pub const EGL_PLATFORM: SDL_GLAttr
Trait Implementations§
§impl Clone for SDL_GLAttr
impl Clone for SDL_GLAttr
§fn clone(&self) -> SDL_GLAttr
fn clone(&self) -> SDL_GLAttr
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more§impl Default for SDL_GLAttr
impl Default for SDL_GLAttr
§fn default() -> SDL_GLAttr
fn default() -> SDL_GLAttr
§impl From<SDL_GLAttr> for i32
impl From<SDL_GLAttr> for i32
§fn from(value: SDL_GLAttr) -> i32
fn from(value: SDL_GLAttr) -> i32
§impl Hash for SDL_GLAttr
impl Hash for SDL_GLAttr
§impl Ord for SDL_GLAttr
impl Ord for SDL_GLAttr
§impl PartialEq for SDL_GLAttr
impl PartialEq for SDL_GLAttr
§impl PartialOrd for SDL_GLAttr
impl PartialOrd for SDL_GLAttr
impl Copy for SDL_GLAttr
impl Eq for SDL_GLAttr
impl StructuralPartialEq for SDL_GLAttr
Auto Trait Implementations§
impl Freeze for SDL_GLAttr
impl RefUnwindSafe for SDL_GLAttr
impl Send for SDL_GLAttr
impl Sync for SDL_GLAttr
impl Unpin for SDL_GLAttr
impl UnwindSafe for SDL_GLAttr
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.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