Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Double Initialization of QGLWidget on X11
QtWS25 Last Chance

Double Initialization of QGLWidget on X11

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 1.8k Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • A Offline
    A Offline
    Alemarius Nexus
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved