It's a general limitation of OpenGL, that calls to OpenGL can only occur from a single thread. There is no easy way to work around that limitation, pre OpenGL version 4+.
On Mon, Nov 5, 2012 at 3:21 PM, Gabriele Lanaro <[email protected]>wrote: > I've tried several approaches to run pyglet in parallel with the executing > code. One (partially) successful solution was to simply run pyglet-related > stuff into a mutliprocessing.Process and communicating using a sync > primitive such as a Queue. The problem I'm having is that this approach > doesn't play nicely with all the drivers, a test code like the following, > works nicely on 'radeon' open source drivers, but it doesn't work on > proprietary nvidia drivers (the subprocess sort-of crashes at line 6). If I > remove the call to Batch (or any other opengl-related call) it works with > both video cards/drivers. Do you think there's an explanation for this? I'd > prefer avoiding to restrict all references to opengl in just one process > the reason is that I basically cache shaders in the main process. I was > wondering if there exist some way to prevent this kind of problems. > -------------------------- > import pyglet > import multiprocessing > b = pyglet.graphics.Batch() > > def inprocess(): > w = pyglet.window.Window() > pyglet.app.run() > > p = multiprocessing.Process(target=inprocess) > p.start() > p.join() > --------------------------- > > -- > You received this message because you are subscribed to the Google Groups > "pyglet-users" group. > To view this discussion on the web visit > https://groups.google.com/d/msg/pyglet-users/-/SOjRn2XTbF8J. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/pyglet-users?hl=en. > -- Tristam MacDonald Software Development Engineer, Amazon.com http://swiftcoder.wordpress.com/ -- You received this message because you are subscribed to the Google Groups "pyglet-users" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/pyglet-users?hl=en.
