Opening 2 Glut Windows in separate threads

I am experimenting with threads and GLUT. It worked when I opened a single thread that does the init and glutmainloop.

However, I tried adding a second thread with the same function to pthread_create.

I got this error when trying to run it

GLUT: Fatal Error in (unamed): visual with necessary capabilities not found.

I googled it up and the tips I got was to increase the Depth (bits per pixel) in Xlib?

I may be wrong, but I believe that GLUT does not support multiple threads (i.e. the GLUT context is not thread safe). At least it’s worth checking if you haven’t already.