You are not logged in.


Sunday, November 6th 2011, 7:15pm

QGLWidget rendering from thread blocks on swapBuffers()

I have a strange problem rendering OpenGL to QGLWidget from a different thread than the main thread.
There are a lot of official statements from Qt Developers that it is "perfectly possible" to do rendering from a different thread. I followed the explanation in:…dglapplications

I implemented it nearly the same way. The only difference is, that I dont use QWorkspace with different GLWidgets but instead I just create a MainWindow with GLWidget as central widget.
When I start the application, the rendering thread starts rendering frames with a triangle at a random position. After a while (sometimes 2 seconds, sometimes 10 seconds) the thread starts to block on the swapBuffers() call for a very long time. Sometimes swapBuffers() returns spontanously after several seconds. When I move the mouse pointer over the widget or the main window, the swapBuffers returns immediately and the as long as I move the mouse pointer swapBuffers() does not block. After moving the mouse out of the widget or just stop moving the mouse, rendering continues for some seconds and then swapBuffers start blocking again.
I have absolutely no explanation for this behaviour. I am aware that swapBuffers() regulary blocks until a frame is completed and it's also clear to me, that a wait for vsync also might happen during OpenGL buffer swap call. But that should happen in some milliseconds and not block for several seconds. The environment is X11 with GLX.

Does anybody has an idea wtf is going on here? I dont even have an idea how to find out what the problem might be..
Does anyone tried to implement the rendering from different thread as explained in the document that I linked above?
I am thankful for every comment!


Tuesday, March 13th 2012, 2:02pm

I have exactly the same problem, with the same example.I am using QT 4.8. I also tried the glHypnotizer demo, and even that has the same problem. (also see article at
Since even the glHypnotizer demo doesn't work I suspect the graphical driver has problems? I am running Ubuntu 11.10 with Unity on a Dell laptop with Mobile Intel GM45 Express Chipset.
Googling this issue did't give any result (except the question above) - anybody any tips?


Wednesday, March 14th 2012, 3:37pm

I found out that it is most likely caused by this bug in libxcb:…ec610c0e5f673c7
When I use the 1.8.1 version of libxcb (download from;O=D) then the problem is solved.