From 31ec51df42b4401210202ff4d0c41ffa447d4732 Mon Sep 17 00:00:00 2001 From: Benoit Bolsee Date: Sun, 25 May 2008 14:32:26 +0000 Subject: [PATCH] Apply BGE patch 12799: Fix quad buffer stereo mode for Windows --- intern/ghost/intern/GHOST_WindowWin32.cpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) diff --git a/intern/ghost/intern/GHOST_WindowWin32.cpp b/intern/ghost/intern/GHOST_WindowWin32.cpp index 230df02c359..905b2f7ac63 100644 --- a/intern/ghost/intern/GHOST_WindowWin32.cpp +++ b/intern/ghost/intern/GHOST_WindowWin32.cpp @@ -871,12 +871,25 @@ static int EnumPixelFormats(HDC hdc) { for(i=1; i<=n; i++) { /* not the idiom, but it's right */ ::DescribePixelFormat( hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd ); w = WeightPixelFormat(pfd); - if(w > weight) { - weight = w; - iPixelFormat = i; + // be strict on stereo + if (!((sPreferredFormat.dwFlags ^ pfd.dwFlags) & PFD_STEREO)) { + if(w > weight) { + weight = w; + iPixelFormat = i; + } + } + } + if (weight == 0) { + // we could find the correct stereo setting, just find any suitable format + for(i=1; i<=n; i++) { /* not the idiom, but it's right */ + ::DescribePixelFormat( hdc, i, sizeof(PIXELFORMATDESCRIPTOR), &pfd ); + w = WeightPixelFormat(pfd); + if(w > weight) { + weight = w; + iPixelFormat = i; + } } } - return iPixelFormat; }