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

QOpenGLTexture not rendered correctly on Linux/Wayland

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • P2: Important
    • None
    • 6.9.0
    • GUI: OpenGL
    • None
    • Linux/Wayland

    Description

      The following program using a QOpenGLTexture renders correctly on Linux/X11, but not on Linux/Wayland (see attached PNGs):

      #include <QApplication>
      #include <QMainWindow>
      #include <QOpenGLFunctions_2_1>
      #include <QOpenGLWidget>
      #include <QOpenGLTexture>
      
      class GLWidget final : public QOpenGLWidget, public QOpenGLFunctions_2_1 {
      
        auto initializeGL() -> void override {
          initializeOpenGLFunctions();
        }
      
        auto paintGL() -> void override {
          glClearColor(0.0, 0.0, 0.0, 1.0);
          glClear(GL_COLOR_BUFFER_BIT);
          auto image = QImage{":/logo"};
          auto texture = QOpenGLTexture{image.flipped()};
          glEnable(GL_TEXTURE_2D);
          glBindTexture(GL_TEXTURE_2D, texture.textureId());
          glColor3d(1.0, 1.0, 1.0);
          glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
          glBegin(GL_QUADS);
          auto tex2Vert = [&](auto s, auto t, auto x, auto y) {
              glTexCoord2d(s, t);
              glVertex2d(x, y);
          };
          tex2Vert(0.0, 0.0, -1.0, -1.0);
          tex2Vert(1.0, 0.0, 1.0, -1.0);
          tex2Vert(1.0, 1.0, 1.0, 1.0);
          tex2Vert(0.0, 1.0, -1.0, 1.0);
          glEnd();
          glDisable(GL_TEXTURE_2D);
        }
      };
      
      auto main(int argc, char** argv) -> int {
        auto app = QApplication{argc, argv};
        auto win = QMainWindow{};
        auto widget = new GLWidget{};
        win.setCentralWidget(widget);
        win.resize(500, 500);
        win.show();
        return QApplication::exec();
      }
      

      Attached is a ZIP containing everything needed to reproduce.

      Attachments

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

        Activity

          People

            lagocs Laszlo Agocs
            wolf.seifert Wolfgang Seifert
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:

              Gerrit Reviews

                There are no open Gerrit changes