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

Can't enable debug context for QOpenGLWidget

    XMLWordPrintable

Details

    • Bug
    • Resolution: Incomplete
    • P3: Somewhat important
    • None
    • 5.8.0
    • GUI: OpenGL
    • None

    Description

      I want to enable OpenGL logging in my Qt QOpenGLWidget app. Code:

      main.cpp

      int main(int argc, char *argv[])
      {
          QApplication app(argc, argv);
      
          QSurfaceFormat format;
          format.setMajorVersion(3);
          format.setMinorVersion(2);
          format.setProfile(QSurfaceFormat::CoreProfile);
          format.setOption(QSurfaceFormat::DebugContext);
      
          app.setApplicationName("MPGLES");
          app.setApplicationVersion("0.0.1");
      
          MainWidget widget;
          widget.setFormat(format);
          widget.show();
      
          return app.exec();
      }
      

      mainwidget.cpp

      MainWidget::MainWidget(QWidget *parent) : QOpenGLWidget(parent), m_debugLogger(Q_NULLPTR) { }
      
      void MainWidget::initializeGL()
      {
          makeCurrent();
          m_functions.initializeOpenGLFunctions();
          m_functions.glClearColor(0, 0, 0, 1);
      
          m_debugLogger = new QOpenGLDebugLogger(context());
          if (m_debugLogger->initialize()) {
              qDebug() << "GL_DEBUG Debug Logger" << m_debugLogger << "\n";
              connect(m_debugLogger, SIGNAL(messageLogged(QOpenGLDebugMessage)), this, SLOT(messageLogged(QOpenGLDebugMessage)));
              m_debugLogger->startLogging();
          }
      
          initializeMP();
          timer.start(12, this);
      }
      

      After i call

      m_debugLogger->initialize()

      I see next output:

      QOpenGLDebugLogger::initialize(): the current context is not a debug context:
      this means that the GL may not generate any debug output at all.
      To avoid this warning, try creating the context with the
      QSurfaceFormat::DebugContext surface format option.

      Why i dont can create a QOpenGLDebugLogger? What's wrong in my code?

      Attachments

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

        Activity

          People

            peppe Giuseppe D'Angelo
            imashine Никита Домановский
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes