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

makeCurrent() needed inside of resizeGL()

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P2: Important
    • Resolution: Done
    • Affects Version/s: 6.4.0
    • Fix Version/s: 6.4.0 Beta1
    • Component/s: GUI: OpenGL
    • Labels:
      None
    • Platform/s:
      Linux/X11
    • Commits:
      ba7a3b8d4a (qt/qtbase/dev) ba7a3b8d4a (qt/tqtc-qtbase/dev)

      Description

      Using Qt6.4.0-0-202205051700 the makeCurrent() call inside of resizeGL()

      #include <QApplication>
      #include <QMainWindow>
      #include <QOpenGLFunctions_2_1>
      #include <QOpenGLWidget>
      
      class GL21Widget : public QOpenGLWidget, public QOpenGLFunctions_2_1 {
        void initializeGL() override {
          initializeOpenGLFunctions();
        }
        void resizeGL(int width, int height) override {
          makeCurrent();
          glMatrixMode(GL_PROJECTION);
          glLoadIdentity();
          glOrtho(0.0, 1.0, 0.0, 1.0, 0.0, 1.0);
        }
        void paintGL() override {
          glClear(GL_COLOR_BUFFER_BIT);
          glPolygonMode(GL_FRONT_AND_BACK, GL_FILL);
          glBegin(GL_TRIANGLES);
          glColor3d(1.0, 0.0, 0.0);
          glVertex3d(0.5, 1.0, 0.0);
          glColor3d(0.0, 1.0, 0.0);
          glVertex3d(0.0, 0.0, 0.0);
          glColor3d(0.0, 0.0, 1.0);
          glVertex3d(1.0, 0.0, 0.0);
          glEnd();
        }
      };
      class GL21Window : public QMainWindow {
      public:
        GL21Window() {
          setCentralWidget(new GL21Widget{});
          setGeometry(500, 200, 750, 750);
          show();
        }
      };
      int main(int argc, char* argv[]) {
        auto app = QApplication{argc, argv};
        auto win = GL21Window{};
        return QApplication::exec();
      }
      

      is needed now. This call should NOT be needed.

        Attachments

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

          Activity

            People

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

              Dates

              Created:
              Updated:
              Resolved:

                Gerrit Reviews

                There are no open Gerrit changes