I am using C# with Visual Studio Express 2008.
I am also using the Tao Framework OpenGL dlls.
What actually causes the SimpleOpenGLControl to redraw when I need it to redraw?
When the SimpleOpenGLControl resides on the active form, all I need to do in order to redraw is call glFlush()开发者_StackOverflow社区
and SimpleOpenGLControl.Invalidate()
.
However, when the control does not reside on the active form I can not get it to redraw, at all. I have found a way to get the control to invalidate through unorthodox means, but this does not redraw the contents of the control (the 3D rendering), it simply leaves me with a blank (black) control.
What do I need to do in order to get the control to actually redraw, regardless of which form is active?
Apparently my problem was not in the SimpleOpenGLControl redrawing, but in the thread that the functions were being called from.
My application waits till it gets new data in one thread, then passes data back to the forms via a delegated display function.
Although no errors or warnings were raised, apparently my OpenGL rendering buffer was not getting filled because the functions that fill it were called from an independent thread.
Although I don't fully understand threadsafe function delegation, I pushed the procedures through under the thread the forms were running on, and my OpenGL rendering buffer is happy once again.
So, the answer to my question was: OpenGL won't populate any rendering buffers unless it happens on the same thread it was initialized.
精彩评论