Hi, I just commited code that among other introduces GL mutex the allows GL manipulation from other threads. In brief, paintGL (which is called periodically and contains preDraw, draw and postDraw methods) tries to lock the mutex, but returns if it fails (no deadlock).
Other threads, like from within simulation or from python, should lock the mutex and wait until it is available. I created class GLLock (in GLViewer.hpp) which is just instantiated and given the GL view it is locking. I was experimenting with many different options, like per-view mutexes (GL context can be accessed only once at time, but multiple contexts may be accessed simultaneously) or global mutex (only one GL context can be accessed once at any time) and the latter seems to be the winner. I still get hardlock (meachine freezes) if I create 2 views and manipulate both of them, even with the global GL lock and proper makeCurrent()/doneCurrent() before/after each gl calls. Can someone reproduce that? Have a look at scripts/gl-test.py and change the "if False:" to "if True:" to crash your machine. It is possible that locking GL will decrease framerate on very fast graphics cards, but I cannot confirm that with my hardware. I think that even in that case the lock should be there, we're not gamers to go for the highest fps possible at all costs... Regards, Vaclav _______________________________________________ Mailing list: https://launchpad.net/~yade-dev Post to : [email protected] Unsubscribe : https://launchpad.net/~yade-dev More help : https://help.launchpad.net/ListHelp

