diff options
author | Tomaka17 <pierre.krieger1708@gmail.com> | 2014-07-30 13:05:58 +0200 |
---|---|---|
committer | Tomaka17 <pierre.krieger1708@gmail.com> | 2014-07-30 13:05:58 +0200 |
commit | 66f6b003d02dc83824725d4aaec0e4a1b4f0968b (patch) | |
tree | ace6eeae571052f381159894f499bb24814ff321 | |
parent | 67349d717a3fbe3dd497b349b399fb2f4e726665 (diff) | |
download | glutin-66f6b003d02dc83824725d4aaec0e4a1b4f0968b.tar.gz glutin-66f6b003d02dc83824725d4aaec0e4a1b4f0968b.zip |
The example now prints OpenGL version
-rw-r--r-- | examples/window.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/examples/window.rs b/examples/window.rs index 5d12c59..39dd014 100644 --- a/examples/window.rs +++ b/examples/window.rs @@ -11,11 +11,20 @@ fn main() { 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); while !window.should_close() { println!("{}", window.wait_events()); + println!("pos: {}", window.get_position()); + gl::Clear(gl::COLOR_BUFFER_BIT); window.swap_buffers(); |