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

QOpenGLContext::format() reports incorrect version

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 5.3.1
    • 5.1.0
    • GUI: OpenGL
    • None
    • Mac Os X 10.8.4

    Description

      The returned format is always the same as the requested format. So even requesting OpenGL Core profile major 6 minor 6 will result in QOpenGLContext::format() returning a format with Core 6.6 versioning (which of course is incorrect). This also affects QWindow::format() in Qt 5.1.0. (in Qt 5.0 I tested and only the context showed this problem, but the QWindow::format() would always return 2.0 in that case).

      // this is in a QWindow derived class
      QSurfaceFormat *m_requestedFormat = new QSurfaceFormat;
      m_requestedFormat = new QSurfaceFormat;
      m_requestedFormat->setDepthBufferSize( 24 );
      m_requestedFormat->setMajorVersion( 6 );
      m_requestedFormat->setMinorVersion( 3 );

      m_requestedFormat->setSamples( 4 );
      m_requestedFormat->setProfile( QSurfaceFormat::CoreProfile );

      m_context = new QOpenGLContext;
      m_context->setFormat( *m_requestedFormat );
      m_context->create();
      setSurfaceType(OpenGLSurface);

      resize( 800, 600 );

      setFormat( m_context->format() );

      create();
      ...

      //QSurfaceFormat fformat = format();
      QSurfaceFormat fformat = m_context->format();
      QString ver = fformat.profile() == QSurfaceFormat::NoProfile ? "None" : (fformat.profile() == QSurfaceFormat::CoreProfile ? "Core" : "Compatibility");
      qDebug() << "OpenGL version:" << ver+":"<<fformat.majorVersion()<<"."<<fformat.minorVersion();

      Attachments

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

        Activity

          People

            sletta Gunnar Sletta
            ecripes Eric Stone
            Votes:
            1 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes