stw: Hack for applications which use wglSetPixelFormat instead of SetPixelFormat.
authorJosé Fonseca <jfonseca@vmware.com>
Tue, 10 Feb 2009 11:37:23 +0000 (11:37 +0000)
committerJosé Fonseca <jfonseca@vmware.com>
Tue, 10 Feb 2009 11:51:47 +0000 (11:51 +0000)
src/gallium/state_trackers/wgl/shared/stw_pixelformat.c

index 12b5ac6d91e79fd0b5b6b593d7703e047c7f577f..84b7b287b91499f7f6ffbe941691f2226791e554 100644 (file)
@@ -256,6 +256,14 @@ stw_pixelformat_set(
       return FALSE;
 
    currentpixelformat = iPixelFormat;
+   
+   /* Some applications mistakenly use the undocumented wglSetPixelFormat 
+    * function instead of SetPixelFormat, so we call SetPixelFormat here to 
+    * avoid opengl32.dll's wglCreateContext to fail */
+   if (GetPixelFormat(hdc) == 0) {
+        SetPixelFormat(hdc, iPixelFormat, NULL);
+   }
+   
    return TRUE;
 }