Module sdl2::video::gl_attr [] [src]

OpenGL context getters and setters

Example

use sdl2::video::{GLProfile, gl_attr};

let sdl_context = sdl2::init().unwrap();
let video_subsystem = sdl_context.video().unwrap();

// Don't use deprecated OpenGL functions
gl_attr::set_context_profile(GLProfile::Core);

// Set the context into debug mode
gl_attr::set_context_flags().debug().set();

// Set the OpenGL context version (OpenGL 3.2)
gl_attr::set_context_version(3, 2);

// Enable anti-aliasing
gl_attr::set_multisample_buffers(1);
gl_attr::set_multisample_samples(4);

let window = video_subsystem.window("rust-sdl2 demo: Video", 800, 600).opengl().build().unwrap();

// Yes, we're still using the Core profile
assert_eq!(gl_attr::context_profile(), GLProfile::Core);
// ... and we're still using OpenGL 3.2
assert_eq!(gl_attr::context_version(), (3, 2));

Structs

ContextFlags
ContextFlagsBuilder

The type that allows you to build a OpenGL context configuration.

Functions

accelerated_visual

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

accum_alpha_size

Gets the attribute: the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0

accum_blue_size

Gets the attribute: the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0

accum_green_size

Gets the attribute: the minimum number of bits for the green channel of the accumulation buffer; defaults to 0

accum_red_size

Gets the attribute: the minimum number of bits for the red channel of the accumulation buffer; defaults to 0

alpha_size

Gets the attribute: the minimum number of bits for the alpha channel of the color buffer; defaults to 0

blue_size

Gets the attribute: the minimum number of bits for the blue channel of the color buffer; defaults to 2

buffer_size

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

context_flags

Gets the applied OpenGL context configuration flags.

context_major_version

Gets the attribute: OpenGL context major version

context_minor_version

Gets the attribute: OpenGL context minor version

context_profile

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

context_version

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

depth_size

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

double_buffer

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

framebuffer_srgb_compatible

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

green_size

Gets the attribute: the minimum number of bits for the green channel of the color buffer; defaults to 3

multisample_buffers

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

multisample_samples

Gets the attribute: the number of samples used around the current pixel used for multisample anti-aliasing; defaults to 0

red_size

Gets the attribute: the minimum number of bits for the red channel of the color buffer; defaults to 3

set_accelerated_visual

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

set_accum_alpha_size

Sets the attribute: the minimum number of bits for the alpha channel of the accumulation buffer; defaults to 0

set_accum_blue_size

Sets the attribute: the minimum number of bits for the blue channel of the accumulation buffer; defaults to 0

set_accum_green_size

Sets the attribute: the minimum number of bits for the green channel of the accumulation buffer; defaults to 0

set_accum_red_size

Sets the attribute: the minimum number of bits for the red channel of the accumulation buffer; defaults to 0

set_alpha_size

Sets the attribute: the minimum number of bits for the alpha channel of the color buffer; defaults to 0

set_blue_size

Sets the attribute: the minimum number of bits for the blue channel of the color buffer; defaults to 2

set_buffer_size

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

set_context_flags

Sets any combination of OpenGL context configuration flags.

set_context_major_version

Sets the attribute: OpenGL context major version

set_context_minor_version

Sets the attribute: OpenGL context minor version

set_context_profile

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

set_context_version

Sets the OpenGL context major and minor versions.

set_depth_size

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

set_double_buffer

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

set_framebuffer_srgb_compatible

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

set_green_size

Sets the attribute: the minimum number of bits for the green channel of the color buffer; defaults to 3

set_multisample_buffers

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

set_multisample_samples

Sets the attribute: the number of samples used around the current pixel used for multisample anti-aliasing; defaults to 0

set_red_size

Sets the attribute: the minimum number of bits for the red channel of the color buffer; defaults to 3

set_share_with_current_context

Sets the attribute: OpenGL context sharing; defaults to false

set_stencil_size

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

set_stereo

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

share_with_current_context

Gets the attribute: OpenGL context sharing; defaults to false

stencil_size

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

stereo

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