diff options
author | Pierre Krieger <pierre.krieger1708@gmail.com> | 2014-08-07 18:13:45 +0200 |
---|---|---|
committer | Pierre Krieger <pierre.krieger1708@gmail.com> | 2014-08-07 18:13:52 +0200 |
commit | 01fd8b1d9e6a43cb8bcb01d7e9b5532578da0d28 (patch) | |
tree | 9158fe2241e2899c071f29a941ad69c7e3606fea | |
parent | e567d7f4fdaaba9f19b7ca32f37445f09ce701df (diff) | |
download | glutin-01fd8b1d9e6a43cb8bcb01d7e9b5532578da0d28.tar.gz glutin-01fd8b1d9e6a43cb8bcb01d7e9b5532578da0d28.zip |
Now calling glViewport on X11 when the window is created
See #14
-rw-r--r-- | src/x11/mod.rs | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/src/x11/mod.rs b/src/x11/mod.rs index 4c88a0b..e7a064d 100644 --- a/src/x11/mod.rs +++ b/src/x11/mod.rs @@ -228,8 +228,8 @@ impl Window { context }; - // returning - Ok(Window{ + // creating the window object + let window = Window { display: display, window: window, im: im, @@ -237,7 +237,20 @@ impl Window { context: context, is_closed: AtomicBool::new(false), wm_delete_window: wm_delete_window, - }) + }; + + // calling glViewport + unsafe { + let ptr = window.get_proc_address("glViewport"); + assert!(!ptr.is_null()); + let ptr: extern "system" fn(libc::c_int, libc::c_int, libc::c_int, libc::c_int) = + mem::transmute(ptr); + let dimensions = window.get_inner_size().unwrap(); + ptr(0, 0, dimensions.val0() as libc::c_int, dimensions.val1() as libc::c_int); + } + + // returning + Ok(window) } pub fn is_closed(&self) -> bool { |