Drawing from different threads in OpenGL
-
Hi, I have created an OpenGL window and can draw on it fine in the same thread as the one that created the window and processes the message queue. If I move the gl code to another thread, it does not draw anymore. Does anyone know if this is possible? thanks, Rich
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far the Universe is winning." -- Rich Cook
-
Hi, I have created an OpenGL window and can draw on it fine in the same thread as the one that created the window and processes the message queue. If I move the gl code to another thread, it does not draw anymore. Does anyone know if this is possible? thanks, Rich
"Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far the Universe is winning." -- Rich Cook
From what I've read in every place I've seen, this doesn't really work, as in drawing from one thread into another thread's hwnd, at least it's not supposed to be done that way. And from my own attempts to do it before I read it windows handles got quite mixed up in the process and nice amount of asserts in MFC code. But as I wrote this was basic MFC app and cannot vouch it is totally true for you. Basicly what you would do is do the work in a thread and message the window owner to do the drawing with the params you calced.