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

Duplicate QGLWidget

Scheduled Pinned Locked Moved General and Desktop
6 Posts 2 Posters 1.4k Views 2 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.
  • A Offline
    A Offline
    Anna234
    wrote on last edited by
    #1

    Hi I'm using QGLWidget to stream the screen of a virtual machine onto a QT UI. It works fine. Now I want to have that content of the QGLWidget been duplicate onto another widget (maybe a second QGLWidget or a QGraphicsView, for example). In this second widget I want to see exactly what I see in the original QGLWidget. Is there any smart way of doing this? A simple but dump way of doing it is to take a screenshot of the QGLWidget and then copy it over to the second widget, and then do this with high frequency. But rather than doing this, I'd like to "stream" the content directly onto a second widget. Any ideas?

    1 Reply Last reply
    0
    • ? Offline
      ? Offline
      A Former User
      wrote on last edited by
      #2

      Hi,
      you could share the OpenGL context between the two widgets. Then render the original graphics offscreen into a texture and use this texture for displaying the content in both widgets.

      1 Reply Last reply
      0
      • A Offline
        A Offline
        Anna234
        wrote on last edited by
        #3

        Do you have any examples by hand showing how to do this?

        ? 1 Reply Last reply
        0
        • A Anna234

          Do you have any examples by hand showing how to do this?

          ? Offline
          ? Offline
          A Former User
          wrote on last edited by
          #4

          @Anna234 No, sorry. But this example http://doc.qt.io/qt-5/qtquick-scenegraph-textureinthread-example.html contains most of what you'll need: It demonstrates how to render to an offscreen surface and how to use setShareContext(). Hope this helps!

          1 Reply Last reply
          0
          • A Offline
            A Offline
            Anna234
            wrote on last edited by
            #5

            I'm using QT4.8 - I think many of these functions are only available in QT5.

            ? 1 Reply Last reply
            0
            • A Anna234

              I'm using QT4.8 - I think many of these functions are only available in QT5.

              ? Offline
              ? Offline
              A Former User
              wrote on last edited by
              #6

              @Anna234 In this case you may want to use the native OpenGL functions.

              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