Linux GLXBadDrawable error

Aperion

04-10-2007 20:48:04

Sooo I'm very purplexed about an error I'm getting:
The program 'python2.5' received an X Window System error.
This probably reflects a bug in the program.
The error was 'GLXBadDrawable'.
(Details: serial 3899 error_code 158 request_code 143 minor_code 5)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)
it works in windows but not in linux, unfortunately I do not know if it happens using opengl in windows.

After some debugging I narrowed the problem down the the following function:
def RenderAll(self):
for ogrewin in self.renderWindows.keys():
try:
ogrewin.OnFrameStarted()
except ogre.OgreException, e:
print '## EXCEPTION ##'
print str(e)
pass

try:
ogre.WindowEventUtilities().messagePump()
self.ogreRoot.renderOneFrame()
except ogre.OgreException, e:
print '## EXCEPTION ##'
print str(e)
pass

for ogrewin in self.renderWindows.keys():
try:
ogrewin.OnFrameEnded()
except:
continue

in particular it dies on the self.ogreRoot.renderOneFrame() line. The application this is for has multiple renderwindows, one for each view type. This function notifies each window of a render update then renders a frame, then notifies them all a frame was rendered. This function is called from an event timer (ala wxPython).

I'm having a very hard time finding information out on this error, the only referance I've been able to find has either been on the nvidia forums or on the wine bug list. So I'm kind of looking for advise on what to check, I am new to ogre so something required for linux may have been missed since development was done on windows as python-ogre wasn't available during initial development.

Thanks in advance.

SiWi

05-10-2007 14:41:37

I don´t know much about Linux, so I can´t help you too much. The only advice I have, is:
It is a problem wit the XWindow System(Linux WindowManager), not a problem with OpenGL.

Game_Ender

05-10-2007 15:18:51

First, does do the Python-Ogre demos (non-wxPython) work?

So I assume you have implemented the things I talked about in the other forum thread if you have done that. I suggest you scale your application down to the simplest one windows case. And no other Ogre stuff except setting the really basic initialization.

I hit this error and what it eventually turned out to be was Ogre creating the GLX context (or maybe the GLX Visual?) with a set of parameters that didn't match the current X11 settings. I had to hack the render system to get it to pick the right ones. I assumed the issue was fixed because other people had gotten it to work on Linux after that.

If all else fails create a simple Ogre C++ application that uses wxWidgets to pull Python out of the mix.

Aperion

05-10-2007 16:53:13

First, does do the Python-Ogre demos (non-wxPython) work?

So I assume you have implemented the things I talked about in the other forum thread if you have done that. I suggest you scale your application down to the simplest one windows case. And no other Ogre stuff except setting the really basic initialization.

I hit this error and what it eventually turned out to be was Ogre creating the GLX context (or maybe the GLX Visual?) with a set of parameters that didn't match the current X11 settings. I had to hack the render system to get it to pick the right ones. I assumed the issue was fixed because other people had gotten it to work on Linux after that.

If all else fails create a simple Ogre C++ application that uses wxWidgets to pull Python out of the mix.
Hey GE, you know, I haven't tried, but they did once upon a time before I switched to ubuntu, so I didn't think to test them again. I do know that ogre works, and python opengl works but I hadn't tried python-ogre again.

And yes I implemented the solutions you mentioned in the other thread, and they seamed to work and the application moves beyond the init process and tries to render. I did notice also the it does generate a (what looks to be) a proper window handle.

Can you explain a little more what you mean when you say the "Ogre creating the GLX context (or maybe the GLX Visual?) with a set of parameters that didn't match the current X11 settings." Being new I can't think of parameters beyond say, resolution and color depth.

Last words, thanks for the help Game_Ender, it is very much appreciated.

Game_Ender

05-10-2007 18:08:08

So here is what I did. I created a wxGLCanvas then dumped the parameters of its FBConfig. Then I did the same with Ogre. I noticed they did not match and hacked the render system to make them match. So I basically trusted that wxWidgets knew how to properly setup its FBConfig.

Now in Ogre 1.4.4+ the GLX render system has changed a little and I think it uses VisiualInfo not FBConfig to setup the GLXContext. This means you have to do the same process but with the VisiualInfo. I basically copy and past (and used) some utility function in OgreGLXUtils.cpp to dump the desired information for debugging.

Here is how you get the FBConfig from a glcanvas (in wxWidgets C++):
FBConfigToString(GDK_WINDOW_XDISPLAY( GetHandle()->window ), *glcanvas->m_fbc);