Double Initialization of QGLWidget on X11



  • Hi.

    I'm using Qt with OpenGL in my program and have discovered an error that happens with QGLWidgets when they are children of QTabWidgets.

    Basically, I have a QTabWidget with two (or more) tabs. The first tab is shown by default and includes just some QLabels. The second one contains the QGLWidget in a QWidget container. When I press a button, the QLabels in the first tab change their text. Now, when I press this button and quickly switch to the second tab, QGLWidget::initializeGL() is called twice. I did some testing and found that this only happens when the new text (the one which is displayed when I pressed the button) intersects the rectangle of the QGLWidget in the second tab (so the QGLWidget has to overpaint part of this label). When they don't intersect, I can't reproduce the error.
    This double initialization is not the only problem I see here. In QGLWidget::initializeGL() I call glCreateShader and immediately afterwards I check this shader with glIsShader. In the first initialization, glIsShader returns GL_TRUE as expected, but the second one always returns GL_FALSE, although I just created the shader. No OpenGL errors were generated when I executed the program in gDEBugger.

    I was able to create a small program where I can reproduce the error. It has the GUI structure described above and a button which, when clicked, changes the label text and automatically switches tabs after 50ms.

    My system, where the error appeared, is Fedora Linux with X11 on x86_64 and I'm using Qt 4.7.4. I initially discovered this with the proprietary Nvidia Display Driver 285.05.09. I've also tested this with OpenGL through Mesa, where the double initialization happens, but glIsShader returns GL_TRUE both times. With Mesa, I also see some X Errors happening (again, only when the label text and the QGLWidget intersect). The output of my program using Mesa is:

    @ [alemariusnexus@nx-main src]$ LD_LIBRARY_PATH="/home/alemariusnexus/mesa/lib" ./qtest
    Mesa warning: couldn't open libtxc_dxtn.so, software DXTn compression/decompression unavailable
    Mesa: Initializing x86-64 optimizations
    Mesa: 3Dnow! detected
    Initializing GLTestWidget 0x1c2e750.
    Result of glIsShader: true
    X Error: BadMatch (invalid parameter attributes) 8
    Extension: 149 (RENDER)
    Minor opcode: 4 (RenderCreatePicture)
    Resource id: 0x124
    Mesa warning: couldn't open libtxc_dxtn.so, software DXTn compression/decompression unavailable
    Mesa: Initializing x86-64 optimizations
    Mesa: 3Dnow! detected
    Initializing GLTestWidget 0x1c2e750.
    Result of glIsShader: true
    X Error: RenderBadPicture (invalid Picture parameter) 171
    Extension: 149 (RENDER)
    Minor opcode: 7 (RenderFreePicture)
    Resource id: 0x76008b8
    @

    I quickly tried this on Windows where the error doesn't seem to happen, but I didn't test it deeply there.

    I've uploaded the source code of the test application "here":http://www.speedshare.org/download.php?id=B966618611.

    Is this a bug in Qt which I should report or am I just doing something I shouldn't?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.