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

QOpenGLContext fail to run versionFunctions<QOpenGLFunctions_3_3_Core>()



  • I'm trying to port my code from windows to MacOS. After a few corrections , the code did compile. But what puzzles me now is that, when I run:
    QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_3_Core>()->glCreateShader...
    it crashes because QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_3_3_Core>() is nullptr,
    which isn't any like description in Qt-official cite https://doc.qt.io/qt-5/qopenglcontext.html#versionFunctions-1 at all. It tells me it should work.
    Here is my environment :
    MacOS big sur public beta 6
    Qt 5.15.1 through homebrew
    Macbook pro 13 retina 2018 with touchbar.
    The problem frustrates me. Is it because of macOS big sur. Can anyone get non-null pointer from macOS Catalina?
    Appreciate your help!



  • It's not my code problem, I've tested another worked example code using versionFunctions<QOpenGLFunctions_3_3_Core>(), it also crashes as EXC_BAD_ACCESS (SIGSEGV).
    So I suppose it's big sur's problem, can anyone test this function using the same code in Catalina and big sur?
    By the way, big sur always crashes on some specific applications. If versionFunctions fails on big sur and success in Catalina. We may feedback Apple this OpenGL issue

    BTW,
    QSurfaceFormat format;
    format.setVersion(3,3);
    format.setProfile(QSurfaceFormat::CoreProfile);
    QOpenGLContext::currentContext()->setFormat(format);
    will fail.
    QOpenGLContext::currentContext()->format().version is 2 1 which is astonishing



  • This post is deleted!


  • This post is deleted!


  • I still couldn't get the rignt answer. Does qopngl has some certain issue with Big Sur. Even if I new an QOpenGLFunctions_3_3_Core, when it uses glcreateshader, the program still crashes with EXC_BAD_ACCESS


  • Lifetime Qt Champion

    Hi and welcome to devnet,

    macOS has a long reputation of being behind in terms of implementing the OpenGL standards.

    Big Sure being still unreleased, you may have unexpected issues. You might want to try the new Qt RHI.



  • @SGaist I think so. BTW, so many programs crash in big sur. Big sur sounds like bug sur.
    And One of Qt cmake component will fail on big sur. Because the directories '/System/Library/Frameworks/OpenGL.framework/Header' '/System/Library/Frameworks/AGL.framework/Header'both disappear in big sur, meaning that
    Qt cmake component couldn't find gl.h in both non-existed directories. I manually change it to '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/OpenGL.framework/Headers/'
    '/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/AGL.framework/Headers/', now at least it appears to work, of course /Library/Developer/CommandLineTools is my xcode-select path.


Log in to reply