From 0c1f15f8425d55a67004b7e0ebf8e6cb5a6481f5 Mon Sep 17 00:00:00 2001 From: Pierre Krieger Date: Sun, 4 Oct 2015 18:36:05 +0200 Subject: Fix vsync being enabled even when disabled --- src/api/wgl/mod.rs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/api/wgl/mod.rs b/src/api/wgl/mod.rs index e118931..f064931 100644 --- a/src/api/wgl/mod.rs +++ b/src/api/wgl/mod.rs @@ -133,13 +133,11 @@ impl Context { let gl_library = try!(load_opengl32_dll()); // handling vsync - if opengl.vsync { - if extensions.split(' ').find(|&i| i == "WGL_EXT_swap_control").is_some() { - let _guard = try!(CurrentContextGuard::make_current(hdc, context.0)); + if extensions.split(' ').find(|&i| i == "WGL_EXT_swap_control").is_some() { + let _guard = try!(CurrentContextGuard::make_current(hdc, context.0)); - if extra_functions.SwapIntervalEXT(1) == 0 { - return Err(CreationError::OsError(format!("wglSwapIntervalEXT failed"))); - } + if extra_functions.SwapIntervalEXT(if opengl.vsync { 1 } else { 0 }) == 0 { + return Err(CreationError::OsError(format!("wglSwapIntervalEXT failed"))); } } -- cgit v1.2.3