Richard Jones' Log: pyglet - another turning-point

Sat, 23 Dec 2006

"incidentally, did you try releasing the context before destroying it?" was the fateful message from Alex that eventually resolved the problems Anthony was having with his older Linux ATI drivers and pyglet's tests.

A recap: when running even the simplest code, Anthony was getting X11 crashes when we attempted to use the GLX API call glXDestroyContext(). A Google search of the symptoms and so forth resulted in a general consensus that there was a bug in the older ATI drivers meaning that glXDestroyContext() just couldn't be called there.

Today over jabber Anthony (in "test monkey" mode) and I spent some time trying to debug the problems he's been having. We resolved quite a few of them, resulting in him being able to run the example programs and start running the test suite. Unfortunately we still hit a big hurdle in the test suite as soon as it tried to open up windows in successive tests.

We narrowed the problem down some more, but weren't really having much luck until Alex happened to log into jabber and sent the message above. Very quickly we had a correct clearing and releasing of the context before window close and suddenly everything's working, including glXDestroyContext!

So here's the (Python) code, if anyone stumbles on this post while searching for the answer I was trying to find...

glFlush()
glXMakeCurrent(display, 0, 0)
XDestroyWindow(display, window)
glXDestroyContext(display, context)

Oh, and regarding my comment yesterday about implementing extension checking pre-GLX-1.1 -- er, there were no extensions in GLX 1.0, so there's no way to query for them :)

Comment by anthony baxter on Wed, 27 Dec 2006

So much pain in getting this working. Thanks heaps for the effort (and to Alex, too).

Now to start thinking about porting bruce. Well, and refactoring it into a UI layer.

Comment by Richard Jones on Wed, 27 Dec 2006

You should see what Alex just checked in...