Hello,
when using wxWidgets 2.9.4 with the open GL example from:
http://wiki.wxwidgets.org/WxGLCanvas#wxGLCanvas_sample
I get an error:
./src/unix/glx11.cpp(51): assert "fbc" failed in wxGLContext(): invalid
GLXFBConfig for OpenGL
This error only occurs in the indirect rendering case, where the X11 server
runs nvidia 295.71 and the remote/local libGL is Mesa-7.3-3.2
(Suse Linux Enterprise 11)
I have not tested other Mesa implementations.
The function which fails is in glx11.cpp: wxGLCanvasX11::InitXVisualInfo
*pFBC = glXChooseFBConfig(dpy, DefaultScreen(dpy), data, &returned);
The problem here is the attribute list. I have printed the data attributes,
they
contain:
data[0]=5 GLX_DOUBLEBUFFER
data[1]=1
data[2]=12 GLX_DEPTH_SIZE
data[3]=16
I then override it with:
data[0]=0;data[1]=0
but even this call fails in this scenario.
The only thing which seems to work is to pass NULL.
So I came up with this first test ("patch")
*pFBC = glXChooseFBConfig(dpy, DefaultScreen(dpy), data, &returned);
if ( *pFBC == NULL) {
printf("No Framebuffer. Fallback to NULL as last resort\n");
*pFBC = glXChooseFBConfig(dpy, DefaultScreen(dpy), NULL, &returned);
}
This completely ignores the given attributes, but works in my
case.
The caller of the function is wxGLCanvasBase::IsDisplaySupported and
wxGLCanvasX11::InitDefaultVisualInfo and this goes back to
the top level in the example:
int args[] = {WX_GL_RGBA, WX_GL_DOUBLEBUFFER, WX_GL_DEPTH_SIZE, 16, 0};
replacing args with NULL does not help, because the pointer data is
replaced with something != NULL in InitXVisualInfo and even
an empty attribute list fails.
Attached is a smaller demo program.
regards,
Martin