diff options
author | David Hewson <dev@daveid.co.uk> | 2016-01-14 15:23:39 +0000 |
---|---|---|
committer | David Hewson <dev@daveid.co.uk> | 2016-01-14 15:50:42 +0000 |
commit | 8a7edc4e406e6b105f38342179c963e080cba5af (patch) | |
tree | 899fd195aa9df7da217fddc6f5ea2d3a19a0a8fa /src/api/wgl | |
parent | 88e64a87a9fcfd0b71803b1adab3cd12787fc90f (diff) | |
download | glutin-8a7edc4e406e6b105f38342179c963e080cba5af.tar.gz glutin-8a7edc4e406e6b105f38342179c963e080cba5af.zip |
Prefer double buffer on wgl if unspecified
According to https://msdn.microsoft.com/en-us/library/windows/desktop/dd318284(v=vs.85).aspx if double buffer is unavailable then a single buffer will be returned
Diffstat (limited to 'src/api/wgl')
-rw-r--r-- | src/api/wgl/mod.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/api/wgl/mod.rs b/src/api/wgl/mod.rs index dcd16b6..a0fce27 100644 --- a/src/api/wgl/mod.rs +++ b/src/api/wgl/mod.rs @@ -383,7 +383,7 @@ unsafe fn choose_native_pixel_format(hdc: winapi::HDC, reqs: &PixelFormatRequire nVersion: 1, dwFlags: { let f1 = match reqs.double_buffer { - None => winapi::PFD_DOUBLEBUFFER_DONTCARE, + None => winapi::PFD_DOUBLEBUFFER, // Should be PFD_DOUBLEBUFFER_DONTCARE after you can choose Some(true) => winapi::PFD_DOUBLEBUFFER, Some(false) => 0, }; @@ -541,10 +541,10 @@ unsafe fn choose_arb_pixel_format(extra: &gl::wgl_extra::Wgl, extensions: &str, out.push(stencil as c_int); } - if let Some(double_buffer) = reqs.double_buffer { - out.push(gl::wgl_extra::DOUBLE_BUFFER_ARB as c_int); - out.push(if double_buffer { 1 } else { 0 }); - } + // Prefer double buffering if unspecified (probably shouldn't once you can choose) + let double_buffer = reqs.double_buffer.unwrap_or(true); + out.push(gl::wgl_extra::DOUBLE_BUFFER_ARB as c_int); + out.push(if double_buffer { 1 } else { 0 }); if let Some(multisampling) = reqs.multisampling { if extensions.split(' ').find(|&i| i == "WGL_ARB_multisample").is_some() { |