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. OpenGL resources
Forum Updated to NodeBB v4.3 + New Features

OpenGL resources

Scheduled Pinned Locked Moved Unsolved General and Desktop
7 Posts 2 Posters 1.0k Views 1 Watching
  • 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.
  • P Offline
    P Offline
    psi-1
    wrote on last edited by
    #1

    As I learned from docs, Qt OpenGL resources (QOpenGLBuffer, QOpenGLShader etc.) must be initialized and destroyed in the same OpenGL context. And there is one context for each QOpenGLWidget. So do I have to create, say, one QOpenGLBuffer for each widget? A buffer may contain a lot of data. May I use a single buffer in many widgets?

    1 Reply Last reply
    0
    • SGaistS Offline
      SGaistS Offline
      SGaist
      Lifetime Qt Champion
      wrote on last edited by
      #2

      Hi,

      Are you looking for context resource sharing ?

      Interested in AI ? www.idiap.ch
      Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      2
      • P Offline
        P Offline
        psi-1
        wrote on last edited by
        #3

        Yes, thanks!

        Correct me if I'm wrong:
        Suppose I have contexts c1 and c2, and c1 is the current context. So I can create OpenGL resourses I don't want to share between contexts, then call setShareContext(c2) and create resourses that will be shared. After that, there will be no way to create resourses that won't be shared, and there will be no way to break the share group.

        And one more question: if I have a shared resourse, when should I destroy it? Which context must be current during the destruction?

        1 Reply Last reply
        0
        • P Offline
          P Offline
          psi-1
          wrote on last edited by
          #4

          Can I share any kind of OpenGL resource? It appears that buffers can be shared while Vertex Array Objects cannot.

          1 Reply Last reply
          0
          • SGaistS Offline
            SGaistS Offline
            SGaist
            Lifetime Qt Champion
            wrote on last edited by
            #5

            From the documentation of QOpenGLVertexArrayObject:

            Note: Vertex Array Objects, like all other OpenGL container objects, are specific to the context for which they were created and cannot be shared amongst a context group.
            

            It's specific to the container objects.

            Interested in AI ? www.idiap.ch
            Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

            1 Reply Last reply
            1
            • P Offline
              P Offline
              psi-1
              wrote on last edited by
              #6

              Thanks again! But what about destruction of OpenGL objects in "share group" of contexts? They probably must be destroyed when any of those contexts is current?

              1 Reply Last reply
              0
              • SGaistS Offline
                SGaistS Offline
                SGaist
                Lifetime Qt Champion
                wrote on last edited by
                #7

                AFAIK, the manipulation of the objects must always be done with a valid context so the current one.

                Interested in AI ? www.idiap.ch
                Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

                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