Important: Please read the Qt Code of Conduct -

QOpenGlWidget and QMatrix4x4: how to invert the Y axis?

  • I have a QOpenGlWidget. The matrix my shader uses is QMatrix4x4().ortho(rect()). This results in the Y axis being directed from top to bottom, which is familiar, but I need the opposite Y axis direction as is customary in OpenGL. My understanding is I need to multiply the ortho matrix by an appropriate transformation matrix, but how to compose this matrix?

    rotate(180.0f, 0.0f, 1.0f, 0.0f) doesn't work, I get no visible image at all with it.

  • Moderators

    1,  0,  0,  0
    0, -1,  0,  0
    0,  0,  1,  0
    0,  0,  0,  1

Log in to reply