Hi Lionel,
I recently remembered that I hadn't mentioned the below patch to you. This is something that we put in the last TG patch to fix an issue with Alice, but I'm not sure if the problem in question is the fault of the Wine OpenGL code or an issue with NVidia's OpenGL driver (I haven't really tried it on other drivers yet).
Alice creates a rendering window, then walks through the pixel formats for that window's DC using DescribePixelFormat. The current implementation of DescribePixelFormat simply creates a new visual for each pixel format by calling glXChooseVisual. Under the NVidia libGL, at least, this creates a new visual even if there's already a visual that matches the requested parameters.
Once we try to create a wgl context, the previous implementation was picking one of the newly created visuals, and initializing the glX context with that. An instant later, we get an X BadMatch error, since the rendering window that Alice is using was created with the default X11DRV visual, not the visual that was created by DescribePixelFormat.
The patch below is a simple fix to just always use the X11DRV visual when creating contexts. Ideally we would somehow recreate the X11DRV window with the new visual, but I suspect that will have to wait for significant restructuring of the X11DRV.
I didn't notice until later that you'd done a similar hack in X11DRV_ChoosePixelFormat, forcing the visual there to be the default. We could do the same thing for X11DRV_DescribePixelFormat as well, or we could simply drop most of the visual management code in graphics/x11drv/opengl.c and use my patch below. What's your preference?
-Gav
Index: wine/dlls/opengl32/wgl.c diff -u wine/dlls/opengl32/wgl.c:1.1.1.3 wine/dlls/opengl32/wgl.c:1.3 --- wine/dlls/opengl32/wgl.c:1.1.1.3 Tue Jan 23 12:12:23 2001 +++ wine/dlls/opengl32/wgl.c Tue Jan 23 12:23:42 2001 @@ -78,6 +78,8 @@ X11DRV_PDEVICE *physDev; XVisualInfo *vis; Wine_GLContext *ret; + int num; + XVisualInfo template;
TRACE("(%08x)\n", hdc);
@@ -88,8 +90,9 @@
physDev = (X11DRV_PDEVICE *)dc->physDev;
- /* First, get the visual for the choosen pixel format */ - vis = physDev->visuals[physDev->current_pf - 1]; + /* First, get the visual in use by the X11DRV */ + template.visualid = XVisualIDFromVisual(X11DRV_GetVisual()); + vis = XGetVisualInfo(display, VisualIDMask, &template, &num);
if (vis == NULL) { ERR("NULL visual !!!\n"); @@ -299,7 +302,7 @@
return ret->func; } else { - ERR("Extension defined in the OpenGL library but NOT in opengl_ext.c... Please report (lionel.ulmer@free.fr) !\n"); + ERR("Extension %s defined in the OpenGL library but NOT in opengl_ext.c... Please report (lionel.ulmer@free.fr) !\n", lpszProc); return NULL; } }