Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

OpenGL + Multithreading = ?

Name: Apprentice 2011-12-08 11:29

Is there any way to draw Geometry in OpenGL to a single window simultaneously via multiple threads?
(Using Untermensch GLUT)

I seem to have managed a ghetto solution: The main display function in the 1st Thread clears the buffers and draws it's geometry, meanwhile the second Thread calls a glClear(NULL) (Doesn't work without it, no idea why), draws it's part of the geometry and calls a glFlush() and just keeps looping for eternity.
This solution sucks balls for several obvious reasons not worth discussing. I tried adding a global boolean state that would manage when the second thread is allowed to draw, though adding it made the thread draw nothing at all.

I'd like to know how you've managed MT in OpenGL, and if there isn't a possibility like that at all I'd like to know some clever techniques to make OpenGL apps run faster.
Thank You.

Name: Anonymous 2011-12-09 1:05

>>10

If you are rendering your stuff in software by writing colors values directly to a buffer in RAM, then using threading to take advantage of a multicore cpu makes sense. But forcing multiple threads to try to push messages over to a single graphics processor at once doesn't seem like a good idea me. You should probably look into other optimizations for speed, like sending the data over to teh graphics processor, and then asking it to draw it when needed, with display lists and such:

http://www.songho.ca/opengl/gl_displaylist.html

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List