[SOLVED] hellogl and threaded rendering: cannot get it to work
-
wrote on 23 Sept 2013, 08:12 last edited by
Hello,
I would like to make the demo application hellogl use a thread for rendering (different thread than the main or GUI thread). I slightly modified the hellogl app by:- starting a new thread in the initializeGL() function
- the new thread will then call the original initializeGL() function
- the new thread will then call on a regular basis the original painGL() function
The result: a black window. I then figured out that I need to call makeCurrent() from the thread. This crashes the application with the message: Cannot make QOpenGLContext current in a different thread
From the main thread, I then I tried to move the QOGLContext to the new thread (before starting the new thread with start()) with context()->moveToThread(newThread) It then tells me again: Cannot make QOpenGLContext current in a different thread
What am I doing wrong?
-
Hi,
You might be interested by "this article":http://blog.qt.digia.com/blog/2011/06/03/threaded-opengl-in-4-8/ to get you started
Hope it helps
-
wrote on 23 Sept 2013, 12:29 last edited by
That helped a lot indeed!
reimplementing the resizeEvent() and paintEvent() functions of QGLWidget did the trick!
Thanks again for always helping out, it is very much appreciated :)
1/3