signaling glutmainloop from a separet thread

do any of you know how to call a glut callback, aka postredisplay from a thread outside of glutmainloop? simply calling it doesnt work. thanks

GLUT is single threaded.

You init and register your callback and the context is active in that thread.

If you have another thread it wouldn’t necessarily be able to issue calls to another context.

The idea is that GLUT loop calls your callback not you.

Steve Baker wrote a source code modification to GLUT (which Mark Kilgard annoyingly refused to take) where you could call the GLUT routines explicitly without handing control over to the GLUT loop. Basically you call input then draw, this way you have total control of the loop which is a nice option when using a simple windowing utility.

This still isn’t multi-threaded but you at least have access to the inner loop.

Calling it will work, the code is there, but it may not have a valid context to do anything. If you’re threaded it can of course be dangerous depending on your draw data, but the gl calls will potentially do nothing especially in a different thread with no context.