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

Scene rendered in a QOpenGLFramebufferObject results to a broken image

XMLWordPrintable

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

      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.

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

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

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes