Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. Installation and Deployment
  4. Using QOpenGLWindow on Mac
Forum Updated to NodeBB v4.3 + New Features

Using QOpenGLWindow on Mac

Scheduled Pinned Locked Moved Unsolved Installation and Deployment
2 Posts 2 Posters 527 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • D Offline
    D Offline
    Dastroet
    wrote on last edited by Dastroet
    #1

    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

    jsulmJ 1 Reply Last reply
    0
    • D Dastroet

      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

      jsulmJ Offline
      jsulmJ Offline
      jsulm
      Lifetime Qt Champion
      wrote on last edited by
      #2

      @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.

      https://forum.qt.io/topic/113070/qt-code-of-conduct

      1 Reply Last reply
      1

      • Login

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • Users
      • Groups
      • Search
      • Get Qt Extensions
      • Unsolved