Attribute Macro gl_headless::gl_headless
source · #[gl_headless]
Expand description
Creates a headless OpenGL context, that is valid throughout the scope of the function.
See examples in the crate root.
Attributes
version = "3.3"
: Specify the OpenGL version, e.g.:#[gl_headless(version = "3.3")]
Example
[dependencies]
gl = "0.14"
gl-headless = "0.2"
use gl_headless::gl_headless;
#[gl_headless]
unsafe fn main() {
let (mut major, mut minor) = (0, 0);
gl::GetIntegerv(gl::MAJOR_VERSION, &mut major);
gl::GetIntegerv(gl::MINOR_VERSION, &mut minor);
println!("OpenGL {major}.{minor}");
}