The example now prints OpenGL version

This commit is contained in:
Tomaka17 2014-07-30 13:05:58 +02:00
parent 67349d717a
commit 66f6b003d0

View file

@ -11,11 +11,20 @@ fn main() {
gl::load_with(|symbol| window.get_proc_address(symbol) as *const libc::c_void); gl::load_with(|symbol| window.get_proc_address(symbol) as *const libc::c_void);
let version = {
use std::c_str::CString;
unsafe { CString::new(gl::GetString(gl::VERSION) as *const i8, false) }
};
println!("OpenGL version {}", version.as_str().unwrap());
gl::ClearColor(0.0, 1.0, 0.0, 1.0); gl::ClearColor(0.0, 1.0, 0.0, 1.0);
while !window.should_close() { while !window.should_close() {
println!("{}", window.wait_events()); println!("{}", window.wait_events());
println!("pos: {}", window.get_position());
gl::Clear(gl::COLOR_BUFFER_BIT); gl::Clear(gl::COLOR_BUFFER_BIT);
window.swap_buffers(); window.swap_buffers();