Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
Unable to create compatibility profile
dethtoll last edited by
We're upgrading an existing application to use Qt. Most of the transition has been smooth, but we're having trouble with context creation on one of our computers.
This application currently uses some legacy OpenGL functions, so we need to request a compatibility profile. This works fine for three of our machines, which are all running Windows 10 with newer (last 2-3 years) graphics cards. But one of our machines (running an AMD 6900 series and Windows 7) creates a context with a core profile rather than a compatibility profile.
The 6900 series is a bit older (5+ years) at this point, but they're still moderately powerful cards. We had no issues accessing compatibility functions when we used GLEW. But perhaps those cards do not fully support all compatibility functionality?
Any suggestions on where we'd start debugging this? I've found several 3rd-party utilities that list the supported core profiles of the hardware, but haven't found any that list the compatibility profiles.
Here's how we're setting up our default context (before QApplication is created):
QSurfaceFormat defaultSurfaceFormat; defaultSurfaceFormat.setVersion(3, 2); defaultSurfaceFormat.setProfile(QSurfaceFormat::CompatibilityProfile); defaultSurfaceFormat.setDepthBufferSize(24); defaultSurfaceFormat.setStencilBufferSize(8); defaultSurfaceFormat.setSamples(8); QSurfaceFormat::setDefaultFormat(defaultSurfaceFormat);
And here's how we're getting the equivalent typesafe functions in our QOpenGLWidget:
QOpenGLContext* context = QOpenGLContext::currentContext(); // Returns NULL on the problem PC QOpenGLFunctions_3_2_Compatibility* functions = context->versionFunctions<QOpenGLFunctions_3_2_Compatibility>();
When we query for the actual context version on that machine, it shows that it creates the same profile version (3.2 in this case), but uses a Core rather than Compatibility profile.
dethtoll last edited by
We found that the problem does not appear to occur if do not specify the version and profile explicitly (i.e. comment out the calls to setVersion and setProfile in my previous post).
We'll run with that for now, but this behavior is definitely confusing. The default profile is OpenGLContextProfile::NoProfile, and the documentation for NoProfile states "OpenGL version is lower than 3.2. For 3.2 and newer this is same as CoreProfile."
It's definitely unexpected that we can successfully query compatibility functions if we don't specify a compatibility profile.