Can I modify the scenegraph in a non GL thread?

What operations am I safe to call from a thread other than the GL context?

For instance, can I modify (generate?) RenderStates?  Can I load textures?  Specify lights?

Or is it really that anything that touches the scenegraph must be run from inside the GL context thread?


Personally I started out with threads, but it became too cumbersome compared to the gains. There is no list of stuff you must do in the GL thread, you'll have to follow the code and see if there are any calls to GL (as common sense isn't always enough). You can't load textures though, if I remember correctly.

If you find some calls that must be made inside GL thread, write them down and maybe in time we can compile a complete list.

textureloading works fine outside the gl thread. in our hockeygame we load everything in a separate thread(arena, players etc) and only do the actual attaching to the main scenegraph in the opengl thread…

After trying to tiptoe around it, I simply coded up an indirection proxy.  Basically, I use reflection to generate a proxy class for each of our 3D game objects.  The proxy class queues up method invocations (and arguments), and the GL thread processes the queue in its update().

Not sure if it's an ideal solution, but it seems to work pretty well.

Are you using GameTaskQueueManager and GameTaskQueue by any chance?  Sounds similar.