Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

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

    General and Desktop
    2
    2
    475
    Loading More Posts
    • 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.
    • N
      neon29 last edited by

      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

      1 Reply Last reply Reply Quote 0
      • C
        ccleung last edited by

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

        1 Reply Last reply Reply Quote 0
        • First post
          Last post