A little more:
From http://doc.qt.nokia.com/4.7/qglwidget.html#details
So instead of transferring the widget into another thread, you can render from another thread on a timer or something, or intercept the update calls from your GUI thread and send a signal to your render thread.It is possible to render into a QGLWidget from another thread, but it requires that all access to the GL context is safe guarded. The Qt GUI thread will try to use the context in resizeEvent and paintEvent, so in order for threaded rendering using a GL widget to work, these functions need to be intercepted in the GUI thread and handled accordingly in the application.
The render thread just needs to call the makeCurrent() method on your GL widget and then render. You may also have to explicitly swap buffers as well using the swapBuffer() method on the QGLWidget. Make sure you are only rendering from one place at a time. You can get funky results if you have multiple threads sending commands to the GL pipeline for your context and screwing up the order of operations.
I have not tried this rendering from another thread stuff, but it seems supported in the documentation contrary to what others in this thread have said.




Reply With Quote
Bookmarks