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

Scene rendered in a QOpenGLFramebufferObject results to a broken image

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • P2: Important
    • None
    • 5.2.1
    • GUI: OpenGL
    • None
    • Windows 7

    Description

      qt_gl_read_framebuffer does not work correctly.

      QImage is initialized as:
      QImage img(size, (alpha_format && include_alpha) ? QImage::Format_ARGB32_Premultiplied : QImage::Format_RGB32);

      Since OpenGL does not support that premultiplied format, results are broken.

      Workaround is to use:
      QImage img(QSize(width, height), QImage::Format_RGBA8888);
      GLint fmt = GL_RGBA;
      glReadPixels(0, 0, w, h, fmt, GL_UNSIGNED_BYTE, img.bits());

      Attached is the image how it looks like.
      Left image is when scene is rendered using QOpenGLFramebufferObject and right image with the workaround used.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              sletta Gunnar Sletta
              qtcomsupport Qt Support
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes