Important: Please read the Qt Code of Conduct -

QOpenGLContext for OpenGL version 3.3

  • I'm running OS X 10.9.4 and Qt 5.3.1. I need to create a QOpenGLContext that uses Open GL 3.3. My system reports 100% compatibility with OpenGL 3.3, however I am getting a context that supports 2.1 only. As well, calling versionFunctions<QOpenGLFunctions_3_3_Core>() returns 0.

    What is the correct modification to, say, the OpenGL Window Example ( that makes it possible to use OpenGL 3.3? I've tried to set the desired version on the QSurfaceFormat, but I haven't been able to make it work on this system (on Windows, I get a context with OpenGL version that matches the highest supported by that system -- by default.)


  • Which profile? Asking for version 2.0, 2.1 or a compatibility profile of 3.2+ you will often get a context for a higher version (compat profile of course) since this is compatible with what you have requested.

    Core profile is a different story.
    format.setVersion(3, 3);
    to request a 3.3 core profile.

    Note that the example in question may not function in such a setup since it may not be prepared to handle core profiles (that do not support the old-style shaders, require VAOs, disallow client-side pointers, etc.)

  • Thank you, I was missing the call to setProfile(QSurfaceFormat::CoreProfile).

Log in to reply