Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

Setting QGLFormat doesn't provide the wanted GL version



  • Hi,

    I am trying to set GL version to be 3.2, so I configured the default format this way:

    @
    QGLFormat glFormat;
    glFormat.setVersion(3, 2);
    glFormat.setProfile(QGLFormat::CompatibilityProfile);
    glFormat.setSampleBuffers(true);
    QGLFormat::setDefaultFormat(glFormat);
    @

    In my custom QGLWidget, I use the list initializer to construct the base class:

    @QGLWidget(QGLFormat::defaultFormat(), parent)@

    the GL version returned by glGetString(GL_VERSION) and format() is 4.4, while printing QGLFormat::defaultFormat() gives OpenGL version 3.2.

    I tried stepping through the code, and I found that function QGLWidget::setContext doesn't see the context as valid, so it is recreating it?


Log in to reply