Rendering into QGLWidget that runs at a different thread than main

194 Views Asked by At

I managed to start a QApplication at a different thread than main and run my QGLWidget there, however, when ever I try to execute an opengl command in my main thread I get gl invalid operation error. I suspect if it is about having gl context in a different thread but couldn't find a way to get the context of QGLWidget and set as current in main thread as my QGLWidget runs on a different thread .

Any suggestions?

note:I really need to have seperae threat for GUI and opengl computations.

1

There are 1 best solutions below

1
On

You should have QApplication in main thread (GUI in main thread) and all computations you can move to other threads. But not GUI, only main thread for GUI (QApplication).