Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-123005

[Reg 6.2->6.5+] Qt::AA_ShareOpenGLContexts has stopped working for offscreen rendering

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P1: Critical
    • 6.5.6, 6.8.0 FF
    • 6.5.5, 6.6.2, 6.7.0 Beta3
    • GUI: OpenGL
    • Ubuntu 22.04 in Xorg mode, running in VMware Workstation 16.2.4 (Customer reported this on physical Ubuntu machines with Intel GPUs)
    • Linux/X11
    • 50c81f549 (dev), 2bbfa7f18 (6.7), 304666855 (6.6), b9df93fbb (tqtc/lts-6.5)

    Description

      Customer requirements

      • The app grabs the contents of a QGraphicsView with a QOpenGLWidget viewport, containing standard QGraphicsItems as well as items that paint using direct OpenGL calls.
      • The grab must work regardless of whether the QGraphicsView is visible on screen or not, even if it was never shown yet.

       

      Problems

      • The basic grabbing methods, using QGraphicsView::grab() or QOpenGLWidget::grabFramebuffer(), don't work – they are missing the OpenGL content.
      • A workaround to the above was found: Add an additional "offscreen" QOpenGLWidget that renders the QGraphicsView in its paintGL method, and grab its framebuffer. This worked fine in Qt 5.15 and 6.2.
      • In newer versions of Qt, this workaround no longer works.

       

      To reproduce, build and run the attached project in Release mode, using Qt 6.2.11 first, and then using a newer version of Qt.
       

      Expected outcomes (Qt 6.2.11)
      Most tests will produce a green square and a coloured triangle on a white background (but the "viewport" method only works if the QGraphicsView was shown first)

       
      Actual outcomes (Qt 6.5.5/6.6.2/6.7.0beta3)
      The "viewport" method remains the same as before, but the "offscreen" method no longer captures the coloured triangle at all.

       

      Attachments

        1. gl-item-grab.zip
          3 kB
          Sze Howe Koh
        2. render-grabs.png
          21 kB
          Sze Howe Koh
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            inho Inho Lee
            skoh-qt Sze Howe Koh
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes