View Full Version : OpenGL doesn't work in multithreaded prog, why?

02-07-2008, 06:53 AM
I need to use ARToolkit combining with our university framework, that
controls a robot and it's a multithreaded platform.
I use ARToolkit to grab image by camera, and detect a fiducial
marker. I have a thread dedicated to ARToolkit and an object class
that implement the ARToolkit call function. I call once
glutDisplayFunc(drawInit); glutIdleFunc(Display) to display image in
the initialization. In my ARToolkit's thread I call once
glutMainLoop(), and I have the comunication throught two thread,
because I need to transmit the position of marker detected.

I have a problem with the update of the image, beacause cause a
problem with the control of manipulator by the other thread!!!! If I
remove the glut functions the system works and the marker is detected
and trasmited, but with glut the system don't work well. I don't have
find a solution yet.It would not be a problem on ARToolKit, but on OpenGL.
Usually OpenGL does not work in multithreaded program.
What I can do?

Dark Photon
02-07-2008, 12:50 PM
See Parallel OpenGL FAQ (http://www.equalizergraphics.com/documentation/parallelOpenGLFAQ.html). Also see GDC2005_OpenGL_Performance.pdf (http://ati.amd.com/developer/gdc/GDC2005_OpenGL_Performance.pdf) pages 33-37.