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. How to make multiple QGLWidgets share the same QGLContext?
Forum Updated to NodeBB v4.3 + New Features

How to make multiple QGLWidgets share the same QGLContext?

Scheduled Pinned Locked Moved General and Desktop
15 Posts 4 Posters 7.6k 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.
  • Z Offline
    Z Offline
    zhaopeng
    wrote on last edited by
    #5

    You mean the sharing of QGLContext follows the latest OpenGL specification, right? Now it's clear and I can rest to use it. Thanks a lot!

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tilsitt
      wrote on last edited by
      #6

      [quote author="zhaopeng" date="1356080913"]You mean the sharing of QGLContext follows the latest OpenGL specification, right?[/quote]

      Yes, that's what I mean.

      [quote author="zhaopeng" date="1356080913"]Thanks a lot![/quote]

      You're welcome ;)

      1 Reply Last reply
      0
      • Z Offline
        Z Offline
        zhaopeng
        wrote on last edited by
        #7

        Sorry, I got another question. Can the sharing relationship be propagated and commutated? For example
        @ QGLWidget * glWidget=new QGLWidget(QGLFormat::defaultFormat(),this);
        QGLWidget * glWidget1=new QGLWidget(QGLFormat::defaultFormat(),this,glWidget);
        QGLWidget * glWidget2=new QGLWidget(QGLFormat::defaultFormat(),this,glWidget1);@

        glWidget is the share widget of glWidget1. According to the Qt doc glWidget1 will share its OpenGL resources with glWidget, which can be accessed in glWidget. How about glWidget's OpenGL resources? Can they be accessed in glWidget1?
        Then glWidget1 is passed as share widget to glWidget2, so how about the relationship between glWidget and glWidget2.

        Thanks!

        1 Reply Last reply
        0
        • T Offline
          T Offline
          tilsitt
          wrote on last edited by
          #8

          When a gl widget has another one as sharing gl widget, both of them are pointing to a unique set of share-able resources (it's like sharing smart pointers): glWidget, glWidget1 and glWidget2 all work on a unique set of resources. So, yes glWidget can "access" glWidget1 and glWidget2, glWidget1 can "access" glWidget and glWidget2 and glWidget2 can "access" glWidget and glWidget1. For what I can say, there is no limitation in the number of gl widget sharing the same resources.

          F 1 Reply Last reply
          0
          • Z Offline
            Z Offline
            zhaopeng
            wrote on last edited by
            #9

            [quote author="tilsitt" date="1356098680"]When a gl widget has another one as sharing gl widget, both of them are pointing to a unique set of share-able resources (it's like sharing smart pointers): glWidget, glWidget1 and glWidget2 all work on a unique set of resources. So, yes glWidget can "access" glWidget1 and glWidget2, glWidget1 can "access" glWidget and glWidget2 and glWidget2 can "access" glWidget and glWidget1. For what I can say, there is no limitation in the number of gl widget sharing the same resources.[/quote]

            Great! Thank you for being such a big help! :)

            1 Reply Last reply
            0
            • K Offline
              K Offline
              Kantharaj
              wrote on last edited by
              #10

              I have a problem in sharing a GLContext between two GLWidgets,
              I have Dual monitor system which has got NVidia Graphics Card, Monitors are configured as Screen 0 & Screen 1 ( Separate X Screens). and i am trying to create one GLwidget on Screen 0 and the second GLWidget on Screen 1, if Both GLWidgets are at same screen i am able to share the context but if i create a second GLWidget on Screen 1 context is not sharing. Advance Thanks for any help.

              1 Reply Last reply
              0
              • Z Offline
                Z Offline
                zhaopeng
                wrote on last edited by
                #11

                Are your two monitors connected to the same Nvidia card? I think the context can not be shared if each monitor has its own graphics card unless using SLI.

                1 Reply Last reply
                0
                • K Offline
                  K Offline
                  Kantharaj
                  wrote on last edited by
                  #12

                  Hi zhaopeng!
                  The two monitors are connected to same Nvidia Card and the both are configured as two screens.

                  1 Reply Last reply
                  0
                  • Z Offline
                    Z Offline
                    zhaopeng
                    wrote on last edited by
                    #13

                    Hi,
                    It may be a big problem for me because I also have a plan to use dual monitor. I will give a try when another monitor is available and report the result.

                    1 Reply Last reply
                    0
                    • K Offline
                      K Offline
                      Kantharaj
                      wrote on last edited by
                      #14

                      Thank you very much for your time!!

                      1 Reply Last reply
                      0
                      • T tilsitt

                        When a gl widget has another one as sharing gl widget, both of them are pointing to a unique set of share-able resources (it's like sharing smart pointers): glWidget, glWidget1 and glWidget2 all work on a unique set of resources. So, yes glWidget can "access" glWidget1 and glWidget2, glWidget1 can "access" glWidget and glWidget2 and glWidget2 can "access" glWidget and glWidget1. For what I can say, there is no limitation in the number of gl widget sharing the same resources.

                        F Offline
                        F Offline
                        Feiz
                        wrote on last edited by
                        #15

                        @tilsitt you sure it can run right?

                        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