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

Using QOpenGLWindow on Mac



  • Hi all,

    we are using Qt in a project with OpenGL context. We specify OpenGL compatability as follows:

        QApplication a(argc, argv);
    
        //A surface format specifies several parameters about the OpenGL context we want to create
        QSurfaceFormat format;
        //Set version to OpenGL 4.5 Compatibility in order to allow execution of deprecated OpenGL functions
        format.setRenderableType(QSurfaceFormat::OpenGL);
        format.setMajorVersion(4);
        format.setMinorVersion(5);
        format.setProfile(QSurfaceFormat::CompatibilityProfile);
        format.setOption(QSurfaceFormat::DeprecatedFunctions, true);
        //Enable vsync
        format.setSwapBehavior(QSurfaceFormat::DoubleBuffer);
        //Enable depth buffer
        format.setDepthBufferSize(24);
    

    We run OpenGL functions in a MainWindow using QOpenGL functions compatability:

    class MainWindow : public QOpenGLWindow
    {
        Q_OBJECT
        QOpenGLFunctions_4_5_Compatibility* f;
        \\ ...
    };
    
    void MainWindow::initializeGL()
    {
        //load OpenGL functions
        f = QOpenGLContext::currentContext()->versionFunctions<QOpenGLFunctions_4_5_Compatibility>();
    }
    

    We are confident with this on Linux and Windows. But since OpenGL is deprecated on Mac OS, we are wondering what happens, if we compile and run the code on a MAC machine. Is this going to work? If not is there a way to enable OpenGL on a MAC. AFAIK OpenGL is still available on MAC but considered deprecated.

    I'd be glad if anyone could elaborate on Qt's OpenGL capabilities on MAC :)

    Best Regards,

    Dastroet


  • Lifetime Qt Champion

    @Dastroet said in Using QOpenGLWindow on Mac:

    But since OpenGL is deprecated

    Depricated doesn't mean it is not available. You simply try to build your app and see.


Log in to reply