Function cgl_rs::graphics::init

source ·
pub fn init() -> Result<(), ()>
Expand description

Initializes the CGL Graphics Module.

Note: This method should only be called after there exists a valid OpenGL context.

Returns

Returns Ok(()) if the initialization was successful, otherwise returns Err(()).

Example

cgl_rs::init().expect("Failed to initialize CGL");
let mut window = cgl_rs::Window::new("My Window", 800, 600).unwrap();
window.make_context_current();
cgl_rs::graphics::init().expect("Failed to initialize CGL Graphics Module");
// ...
cgl_rs::graphics::shutdown();
window.destroy();
cgl_rs::shutdown();