There can be lots of stuff that can go wrong with threads, but first of all, do you have the rendering context active ? is it in the same thread or another thread ?
You may also find it very useful to find out why and where it crashes with a debugger.
I use 2 threads: glutMainLoop (main) and one posix thread. I know where it crashes - if I don’t draw anything in my draw-function, it works normal, so, the problem is somewhere in openGL or… maybe this 2 threads can’t work right together!?
I tried:
If I call my draw-function form main everything is good, but if I call the same draw-function from posix thread - it crashes with segmentation fault %(
Well, each thread has its own rendering context. If you created the window in main, then main owns the context, and that’s the only place where you can draw.
Don’t even think about drawing to the same context from different threads. By bypassing GLUT you could make it work, but it is not worth it since it will kill performance. Better do geometry calculations etc in one thread and then draw in the main thread (using proper mutex + condition variable synchronization).