Fix vsync being enabled even when disabled

This commit is contained in:
Pierre Krieger 2015-10-04 18:36:05 +02:00
parent df10bbd163
commit 0c1f15f842

View file

@ -133,15 +133,13 @@ impl Context {
let gl_library = try!(load_opengl32_dll()); let gl_library = try!(load_opengl32_dll());
// handling vsync // handling vsync
if opengl.vsync {
if extensions.split(' ').find(|&i| i == "WGL_EXT_swap_control").is_some() { if extensions.split(' ').find(|&i| i == "WGL_EXT_swap_control").is_some() {
let _guard = try!(CurrentContextGuard::make_current(hdc, context.0)); let _guard = try!(CurrentContextGuard::make_current(hdc, context.0));
if extra_functions.SwapIntervalEXT(1) == 0 { if extra_functions.SwapIntervalEXT(if opengl.vsync { 1 } else { 0 }) == 0 {
return Err(CreationError::OsError(format!("wglSwapIntervalEXT failed"))); return Err(CreationError::OsError(format!("wglSwapIntervalEXT failed")));
} }
} }
}
Ok(Context { Ok(Context {
context: context, context: context,