Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

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: http://doc.qt.io/qt-4.8/qglwidget.html#QGLWidget

    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