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

OpenGL context getters and setters

Example

use sdl2::video::GLProfile;

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

// 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.

GLAttr

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