diff options
author | Tomaka17 <pierre.krieger1708@gmail.com> | 2014-10-27 13:09:36 +0100 |
---|---|---|
committer | Tomaka17 <pierre.krieger1708@gmail.com> | 2014-10-27 13:09:36 +0100 |
commit | f7a50c162ca4f4a4bd695acdd9f94d4286da402d (patch) | |
tree | 0fb862f160a5e29477fb5f47258232dc0c72cfa2 /src | |
parent | a6bc0b0ba0a451ceb6704a1fdb47b4677c1c4761 (diff) | |
download | glutin-f7a50c162ca4f4a4bd695acdd9f94d4286da402d.tar.gz glutin-f7a50c162ca4f4a4bd695acdd9f94d4286da402d.zip |
Bugfix in swap interval for win32
Diffstat (limited to 'src')
-rw-r--r-- | src/win32/init.rs | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/src/win32/init.rs b/src/win32/init.rs index ca99da8..5168cc6 100644 --- a/src/win32/init.rs +++ b/src/win32/init.rs @@ -350,7 +350,16 @@ pub fn new_window(builder_dimensions: Option<(uint, uint)>, builder_title: Strin if builder_vsync { if extra_functions.SwapIntervalEXT.is_loaded() { unsafe { ffi::wgl::MakeCurrent(hdc, context) }; - extra_functions.SwapIntervalEXT(1); + if extra_functions.SwapIntervalEXT(1) == 0 { + tx.send(Err(format!("wglSwapIntervalEXT failed"))); + unsafe { ffi::wgl::DeleteContext(context); } + unsafe { ffi::DestroyWindow(real_window); } + return; + } + + // it is important to remove the current context, otherwise you get very weird + // errors + unsafe { ffi::wgl::MakeCurrent(ptr::null(), ptr::null()); } } } |