QGraphicsScene + OpenGL VBO = widgets disappear?



  • Hello all,

    I'm using a subclass of QGrahicsScene to display normal widgets (via QGraphicsProxyWidgets) on top of a GL scene. This subclass also inherits from QOpenGLFunctions for the glext / GLEW functions.

    Everything is working fine using oldschool OpenGL techniques. Everything also works fine if i use basic modern GL, load shaders to the graphics card, etc....

    The problem appears when i try to use a Vertex Buffer Object (VBO) to store my vertex array in the graphics memory at init, instead of having the vertex array "client side" and sent to the graphics card at each frame. When i do this (use VBO) the overlay/proxy widgets disappear completely.

    I'm following this "modern GL" tutorial
    https://en.wikibooks.org/wiki/OpenGL_Programming/Modern_OpenGL_Tutorial_02
    See section "Using Vertex Buffer Objects (VBO) for efficiency"

    Any idea what can be causing this?? The same problem happens if i use native GLEW, or (as mentioned) if i inherit the functions from QOpenGLFunctions.



  • SOLVED - I needed to unbind the vertex buffer at the end of my drawing function.

    [ ... ]
    glDrawArrays(GL_TRIANGLES, 0, 6);
    glDisableVertexAttribArray(attribute_coord2d);
    glBindBuffer (GL_ARRAY_BUFFER, 0);
    
    painter->endNativePainting ();

Log in to reply
 

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