Threaded QGLWidged -> QGLContext::makeCurrent(): Failed.
Hi,
I'm working on a project in which I have to draw a QGLWidget with constant 60fps. I addition, some textures within the GL-context are changing frequently.
I want to separate that to tasks into two threads, one for the fast-refreshing GL-context and one for texture update and other things. The last one should be the main QApplication thread. I had two approaches of implementing that structure but both result in the error message: QGLContext::makeCurrent(): Failed.
With the first try I basically followed this tutorial:
http://doc.trolltech.com/qq/qq06-gli...glapplications
The second one was to wrap the QGLWidget in a thread, constantly calling the widgets updateGL() function.
I didn't come as far as safely updating the textures as I get the error right after initialization.
I'm workin on Ubuntu, so I called XInitThreads() first.
Does someone have an idea why the makeCurrent fails? Or even a better workaround for the general task?
Thanks.
Re: Threaded QGLWidged -> QGLContext::makeCurrent(): Failed.
Hi beetleskin
I'm trying to do the same thing and get the same error related to QGLContext::makeCurrent() failed. Have you been able to resolve this problem? If so please share it with me cos that would really help me.
Re: Threaded QGLWidged -> QGLContext::makeCurrent(): Failed.
I too am in the same boat. Any help is greatly appreciated.
Re: Threaded QGLWidged -> QGLContext::makeCurrent(): Failed.
If I understand correctly, you want to use QWidget-based class outside main GUI thread. Well, I think its not a good idea:
Quote:
Although QObject is reentrant, the GUI classes, notably QWidget and all its subclasses, are not reentrant. They can only be used from the main thread.
Next thing:
Quote:
two threads, one for the fast-refreshing GL-context and one for texture update and other things. The last one should be the main QApplication thread.
I think that the first one should be in main thread, create a separate thread to play with the textures and pass the result to main thread for display.
Let the main thread handle the display, gl-context refreshing or whatever. Manipulate the image data in other thread, if it needs some heavy processing, and send processed images for display to gui thread.