How should I handle two QGLWidgets which only share the same shaders?

  • Hi all!
    I've just added a second QGLWidget to my app (both QGLWidgets inherit from the same class). While the first one still works as expected, the second one raises a GL_OUT_OF_MEMORY, in the glDrawArrays() method of my paintGL()method, whatever the data which filled the buffers

    I manage to solve this in adding the first QGLWidget as a "share widget" when creating the second one:

    However, now, it seems that the two QGLWidgets are linked/synchronized (especially the camera but only when switching to a widget to another).

    My question is thus more general as I would like to know how I should handle my two QGLWidgets, to avoid conflicts, knowing that they only share the same shaders code (vertex and fragment) but no data (they do not write/read the same buffers).

    EDIT: I use PyQt4

  • I guess two QGLWidgets cannot share context data with each other. Each QGLWidget should has its own context and shader.

Log in to reply

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