-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Alistair Clarkson wrote: > Hi, if anyone can help with this I would be extremely grateful. > Currently I am trying to code a small 3D enviornment where I can > control the central body from an external source. I have been trying > to write a COM server so that I can automate Soya3D (and it works). > The problem is that when I call mainloop my com client is locked up, > I think I can poll mainloop.update but this seems messy and It could > be quite messy. I therefore want to run Soya3D in a seperate thread > which is how I get the error below: > > File "D:\Python24\lib\threading.py", line 442, in __bootstrap > self.run() File "D:\Python24\SoyaTutorial-0.13\tutorial\Cate.py", > line 9, in run soya.MainLoop(self.scene).main_loop() File > "main_loop.pyx", line 165, in _soya.MainLoop.main_loop File > "main_loop.pyx", line 254, in _soya.MainLoop.render File > "renderer.pyx", line 419, in _soya.render File "renderer.pyx", line > 395, in _soya.check_gl_error GLError: GL_INVALID_OPERATION >
You cannot do this, I am afraid. The thread you are calling Soya from does not have a valid OpenGL context (because that was created by the other thread) and you will get such failure. This is not Soya specific, it is a general issue with the access to the graphic hardware - you cannot safely access the card from two different threads, the drivers and the cards are not designed for it. What you can do is to have one thread run all OpenGL/Soya operations and then have another thread feed it with requests for execution. However, you must not call the Soya API directly from the thread which didn't create the OpenGL context. Such designs are pretty messy, unfortunately. At that point you will be probably better off with some other RPC mechanism than blocking COM calls, perhaps something event-based would be better suited. Regards, Jan -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.7 (GNU/Linux) Comment: Using GnuPG with Mandriva - http://enigmail.mozdev.org iD4DBQFGLPtin11XseNj94gRAvSxAJdpgkz1qdx+dFGLxOFB79wG+g/OAJ9Kgfxp aMFW/as70XUVSDjx1tVwwQ== =xAsM -----END PGP SIGNATURE----- _______________________________________________ Soya-user mailing list Soya-user@gna.org https://mail.gna.org/listinfo/soya-user