pub struct GLAttr<'a> { /* private fields */ }
Expand description
OpenGL context getters and setters. Obtain with VideoSubsystem::gl_attr()
.
Implementations§
source§impl<'a> GLAttr<'a>
impl<'a> GLAttr<'a>
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub fn stereo(&self) -> bool
pub fn stereo(&self) -> bool
Gets the attribute: whether the output is stereo 3D; defaults to off
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub 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
sourcepub fn set_context_major_version(&self, value: u8)
pub fn set_context_major_version(&self, value: u8)
Sets the attribute: OpenGL context major version
sourcepub fn context_major_version(&self) -> u8
pub fn context_major_version(&self) -> u8
Gets the attribute: OpenGL context major version
sourcepub fn set_context_minor_version(&self, value: u8)
pub fn set_context_minor_version(&self, value: u8)
Sets the attribute: OpenGL context minor version
sourcepub fn context_minor_version(&self) -> u8
pub fn context_minor_version(&self) -> u8
Gets the attribute: OpenGL context minor version
sourcepub 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)
sourcepub 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
sourcepub 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)
sourcepub 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)
sourcepub 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.
sourcepub fn context_version(&self) -> (u8, u8)
pub fn context_version(&self) -> (u8, u8)
Gets the OpenGL context major and minor versions as a tuple.
source§impl<'a> GLAttr<'a>
impl<'a> GLAttr<'a>
sourcepub 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 = 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();
sourcepub fn context_flags(&self) -> ContextFlags
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");
}