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

Projection matrix is not set properly in QGL2PaintEngineEx::beginNativePainting() for systems with OpenGL 3.1

    XMLWordPrintable

Details

    • Bug
    • Resolution: Out of scope
    • Not Evaluated
    • None
    • 4.8.3
    • GUI: OpenGL
    • None
    • Win 7 Lenovo E420 with Intel Graphics HD 3000

    Description

      I am referring to the changes of this commit:
      http://qt.gitorious.org/qt/qt/commit/2f59eaeee1fbe33d07b0e7d0747afd8658df95ac

      I use native OpenGL painting in the drawBackground() slot of some class that derives from QGraphicsScene. Compare the code snippets in the attachment. The drawing works completely fine in most of the cases. Only on some rare systems, it fails. It turned out, that the problem occurs for systems with video drivers that support OpenGL up to version 3.1. On those systems, I observed that the projection matrix is not set properly for a block of native OpenGL drawing instructions in a paint method, namely the projection matrix is the identity instead of some othogonal projection matrix that scales the scene properly to the widget size, i.e. the result of glOrtho(0, width, height, 0, -999999, 999999). I digged a little further and found out that on the problematic systems (OpenGL 3.1), the newly introduced check in QGL2PaintEngineEx::beginNativePainting() fails, and therefore the projection matrix is not set correctly. Indeed, the described problem is not visible for Qt 4.7, but only for Qt 4.8 versions.

      Note that I've verified this issue only on two machines (Lenovo E Series with Intel Graphics HD 3000). It still might be that the issue is related to some driver bug, although any updating/down-grading was not successful.

      However, reading the commit message ("The Core profile was introduced in OpenGL 3.2 and if chosen removes all deprecated functionality from the OpenGL API.") I would suggest the following fix for qpaintengineex_opengl2.cpp, around line 570:

      Instead of
      (fmt.majorVersion() == 3 && fmt.minorVersion() < 1)
      have
      (fmt.majorVersion() == 3 && fmt.minorVersion() <= 1 )

      Best regards,
      Norman

      Attachments

        1. Scene.cpp
          2 kB
        2. Scene.hpp
          0.3 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            rodal Samuel Rødal
            normiboy Norman Juchler
            Votes:
            3 Vote for this issue
            Watchers:
            7 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes