aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTomaka17 <pierre.krieger1708@gmail.com>2014-08-07 18:48:27 +0200
committerTomaka17 <pierre.krieger1708@gmail.com>2014-08-07 18:48:34 +0200
commit61781cf20928f4a9cb51d93c7c705f9ada75ca6d (patch)
tree33a778b07c439ea4ec63269fb3591a40dcb1a756 /src
parentda5e3727193a6663d7633e561fa564d033ed1c61 (diff)
downloadglutin-61781cf20928f4a9cb51d93c7c705f9ada75ca6d.tar.gz
glutin-61781cf20928f4a9cb51d93c7c705f9ada75ca6d.zip
Call glViewport on windows init for win32
See #14
Diffstat (limited to 'src')
-rw-r--r--src/win32/ffi.rs3
-rw-r--r--src/win32/init.rs15
2 files changed, 16 insertions, 2 deletions
diff --git a/src/win32/ffi.rs b/src/win32/ffi.rs
index 40dec56..3afa18a 100644
--- a/src/win32/ffi.rs
+++ b/src/win32/ffi.rs
@@ -717,6 +717,9 @@ extern "system" {
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms633519(v=vs.85).aspx
pub fn GetWindowRect(hWnd: HWND, lpRect: *mut RECT) -> BOOL;
+ //
+ pub fn glViewport(x: libc::c_int, y: libc::c_int, w: libc::c_int, h: libc::c_int);
+
// http://msdn.microsoft.com/en-us/library/windows/desktop/ms684175(v=vs.85).aspx
pub fn LoadLibraryW(lpFileName: LPCWSTR) -> HMODULE;
diff --git a/src/win32/init.rs b/src/win32/init.rs
index d2aec5e..7e7f399 100644
--- a/src/win32/init.rs
+++ b/src/win32/init.rs
@@ -323,14 +323,25 @@ pub fn new_window(builder: WindowBuilder) -> Result<Window, String> {
};
// building the struct
- tx.send(Ok(Window{
+ let window = Window{
window: real_window,
hdc: hdc,
context: context,
gl_library: gl_library,
events_receiver: events_receiver,
is_closed: AtomicBool::new(false),
- }));
+ };
+
+ // calling glViewport
+ unsafe {
+ use libc;
+ let dimensions = window.get_inner_size().unwrap();
+ ffi::glViewport(0, 0, dimensions.val0() as libc::c_int,
+ dimensions.val1() as libc::c_int);
+ }
+
+ // sending
+ tx.send(Ok(window));
// now that the `Window` struct is initialized, the main `Window::new()` function will
// return and this events loop will run in parallel