Struct sdl2::video::gl_attr::GLAttr

source ·
pub struct GLAttr<'a> { /* private fields */ }
Expand description

OpenGL context getters and setters. Obtain with VideoSubsystem::gl_attr().

Implementations§

source§

impl<'a> GLAttr<'a>

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

pub fn set_buffer_size(&self, value: u8)

Sets the attribute: the minimum number of bits for frame buffer size; defaults to 0

source

pub fn buffer_size(&self) -> u8

Gets the attribute: the minimum number of bits for frame buffer size; defaults to 0

source

pub fn set_double_buffer(&self, value: bool)

Sets the attribute: whether the output is single or double buffered; defaults to double buffering on

source

pub fn double_buffer(&self) -> bool

Gets the attribute: whether the output is single or double buffered; defaults to double buffering on

source

pub fn set_depth_size(&self, value: u8)

Sets the attribute: the minimum number of bits in the depth buffer; defaults to 16

source

pub fn depth_size(&self) -> u8

Gets the attribute: the minimum number of bits in the depth buffer; defaults to 16

source

pub fn set_stencil_size(&self, value: u8)

Sets the attribute: the minimum number of bits in the stencil buffer; defaults to 0

source

pub fn stencil_size(&self) -> u8

Gets the attribute: the minimum number of bits in the stencil buffer; defaults to 0

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

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

source

pub fn set_stereo(&self, value: bool)

Sets the attribute: whether the output is stereo 3D; defaults to off

source

pub fn stereo(&self) -> bool

Gets the attribute: whether the output is stereo 3D; defaults to off

source

pub fn set_multisample_buffers(&self, value: u8)

Sets the attribute: the number of buffers used for multisample anti-aliasing; defaults to 0

source

pub fn multisample_buffers(&self) -> u8

Gets the attribute: the number of buffers used for multisample anti-aliasing; defaults to 0

source

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

source

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

source

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

source

pub fn accelerated_visual(&self) -> bool

Gets the attribute: whether to require hardware acceleration; false to force software rendering; defaults to allow either

source

pub fn set_context_major_version(&self, value: u8)

Sets the attribute: OpenGL context major version

source

pub fn context_major_version(&self) -> u8

Gets the attribute: OpenGL context major version

source

pub fn set_context_minor_version(&self, value: u8)

Sets the attribute: OpenGL context minor version

source

pub fn context_minor_version(&self) -> u8

Gets the attribute: OpenGL context minor version

source

pub fn set_context_profile(&self, value: GLProfile)

Sets the attribute: type of GL context (Core, Compatibility, ES)

source

pub fn context_profile(&self) -> GLProfile

Gets the attribute: type of GL context (Core, Compatibility, ES)

source

pub fn set_share_with_current_context(&self, value: bool)

Sets the attribute: OpenGL context sharing; defaults to false

source

pub fn share_with_current_context(&self) -> bool

Gets the attribute: OpenGL context sharing; defaults to false

source

pub fn set_framebuffer_srgb_compatible(&self, value: bool)

Sets the attribute: requests sRGB capable visual; defaults to false (>= SDL 2.0.1)

source

pub fn framebuffer_srgb_compatible(&self) -> bool

Gets the attribute: requests sRGB capable visual; defaults to false (>= SDL 2.0.1)

source

pub fn set_context_no_error(&self, value: bool)

Sets the attribute: disables OpenGL error checking; defaults to false (>= SDL 2.0.6)

source

pub fn context_no_error(&self) -> bool

Gets the attribute: disables OpenGL error checking; defaults to false (>= SDL 2.0.6)

source

pub fn set_context_version(&self, major: u8, minor: u8)

Sets the OpenGL context major and minor versions.

source

pub fn context_version(&self) -> (u8, u8)

Gets the OpenGL context major and minor versions as a tuple.

source§

impl<'a> GLAttr<'a>

source

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 = sdl2::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();
source

pub fn context_flags(&self) -> ContextFlags

Gets the applied OpenGL context configuration flags.

Example
let sdl_context = sdl2::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> 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> 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> 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, U> TryFrom<U> for T
where 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 T
where 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.