OpenGL: fix wglMakeCurrent bug

Roderick Colenbrander thunderbird2k at
Sat Oct 7 13:08:26 CDT 2006


The opengl32 function wglMakeCurrent is routed through gdi32.dll to the display driver. One of the parameters of wglMakeCurrent is a hDC. Inside gdi32 this hDC is used to get access to the display driver. In case of wglMakeCurrent this hDC can be NULL in case the other parameter (hglrc) is NULL. When the hDC is NULL, the driver can't be accessed. Right now this case is broken.

Further in upcoming patches other functions which don't have a hDC will be routed through gdi32.dll. This patch creates a global device context which can be used in such cases.

In case of wglMakeCurrent this global device context is used when hglrc is NULL. This is fine as the wglMakeCurrent function doesn't perform any operations on the hDC and it is also specified like this in the opengl docs. The end result of the patch is that wglMakeCurrent(NULL, NULL) will work again.

Roderick Colenbrander
GMX DSL-Flatrate 0,- Euro* - Überall, wo DSL verfügbar ist!
NEU: Jetzt bis zu 16.000 kBit/s!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: wgl_makecurrent_fix.patch
Type: text/x-patch
Size: 1782 bytes
Desc: not available
Url :

More information about the wine-patches mailing list