yess, yess, yessssss !!!!
it's working :D

And this makes so much sense

Thanks for your time Mike.

P.S.: The tool for searching the mailing list archive (on sourceforge) doesn't work for me... It always return : "PyOpenGL: Searching mail lists gives 0 results" even if I type a word that is in some mails.


ªŁ€×


On Sun, Sep 21, 2008 at 10:50 AM, Mike C. Fletcher <mcfletch@vrplumber.com> wrote:
Alexandre Lacoste wrote:
Hi.
First : Many thanks for this great python bindings !!

I'm trying to thread my opengl class but it is not working. I get segmentation fault at glutInit or glutInitDisplayMode

here is the simplest example I was able to build. It never gets to the : print "end" part.... It seg fault before.
Most GUI libraries are inherently single-threaded.  You can often get around the problem by *first* importing the GUI library in the GUI thread (i.e. *not* in the main thread).  That is, the first time GLUT (or wx, or Tk, or any GUI lib I've seen recently) is imported needs to be within the GUI thread so that it will create its global state inside that thread, rather than the main thread.

The attached version of the code runs fine on my machine.  The only change is to move *all* imports of GLUT into the background/GUI thread by separating it out into a separate module.  You may want to set up a few queues to transfer data  in the call to "run" so that your two threads can communicate easily.

HTH,
Mike

--
________________________________________________
 Mike C. Fletcher
 Designer, VR Plumber, Coder
 http://www.vrplumber.com
 http://blog.vrplumber.com