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

OpenGL 4.6 unable to set surfaceformat



  • This morning Ubuntu updated Mesa to version 20.0.8. Since this update Qt is unable to set the correct surfaceformat and it will always default to OpenGL 4.6. This leads to a segfault when trying to access any OpenGL function. I have confirmed that OpenGL runs correctly and I am able to select core profile 4.1 on other applications using GLFW.

    I set the core format in my Qt application using:

    QSurfaceFormat glFormat;
    glFormat.setProfile(QSurfaceFormat::CoreProfile);
    glFormat.setVersion(4, 1);
    
    glFormat.setOption(QSurfaceFormat::DebugContext);
    glFormat.setSamples(4);
    glFormat.setSwapInterval(0);
    
    QSurfaceFormat::setDefaultFormat(glFormat);
    

    and use a pointer to the QOpenGLFunctions_4_1_core object to handle calls to openGL

    When printing the version string using:

    QString glVersion;
    glVersion = reinterpret_cast<const char*>(glGetString(GL_VERSION));
    qDebug() << "Using" << qPrintable(glVersion);
    

    It will consistently print out:
    "Using 4.6 (Core Profile) Mesa 20.0.8"

    No, matter what major or minor version I set in the surface format. There is also no QOpenGLFunctions_4_6_core available to use instead. Is this a bug in Qt or am I missing a setting somewhere?



  • I forgot to mention that this was on Qt 5.10. Upgrading to 5.15 did not solve anything.


Log in to reply