min_gl
This is a small library that brings together glfw and glad to handle
boilerplate code. The user only needs to create a Display, which initializes
and terminates necessary stuff as a smart pointer. Hence, in the lifetime of the
Display, OpenGL calls can be freely made without any other setup.
Example
use glfw::WindowEvent;
use min_gl::{gl, Display, Options};
fn main() {
let mut event_count = 0u32;
let mut disp = Display::new(
Options {
width: 1280,
height: 720,
title: "Display Test".into(),
fullscreen: false,
decorated: true,
msaa: Some(16),
vsync: true,
},
|event| {
event_count += 1;
match event {
WindowEvent::Key(k, _, a, _) => println!("Key `{:?}` is {:?}ed!", k, a),
e => println!("Some {:?} happened!", e),
}
},
);
while !disp.window().should_close() {
disp.update();
gl::ClearColor(0.7, 0.5, 0.6, 1.0);
disp.render();
}
println!("In total {} window events happened!", event_count);
}
Glad 2 was used with the fallowing options on 16.02.2022:
- Generator: Rust
- APIs: gl; Version 4.6 Core
- Extensions: All
- Options: None
Perma Link
Copyright (C) 2022 Cem GeƧgel gecgelcem@outlook.com