Hi, I need to know whether my users have opengl 2.1, 3.2 with compatibility profile or 3.2 with core profile only, and I'm having a hard time getting that information through Qt 5's opengl support. With Qt4, I used something like this:
if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_2_1) qDebug() << "OpenGL version 2.1 or higher is present."; if (QGLFormat::openGLVersionFlags() & QGLFormat::OpenGL_Version_3_2) qDebug() << "OpenGL version 3.1 or higher is present."; But that module is deprecated, so I'm trying not to use it. But I cannot figure out another way of checking the version by trying to create a vernsionfunctions object and see if it's 0 or not: QOpenGLContext *context = 0; QSurfaceFormat format; // 3.2 Compatibility format.setMajorVersion( 3 ); format.setMinorVersion( 2 ); format.setProfile( QSurfaceFormat::CoreProfile ); setFormat( format ); // Create an OpenGL context context = new QOpenGLContext; context->setFormat( format ); context->create(); context->makeCurrent(this); QOpenGLFunctions_3_2_Core *f0 = context->versionFunctions<QOpenGLFunctions_3_2_Core>(); version32Core = f0; delete context; // 3.2 Core format.setProfile( QSurfaceFormat::CompatibilityProfile ); setFormat( format ); // Create an OpenGL context context = new QOpenGLContext; context->setFormat( format ); context->create(); context->makeCurrent(this); QOpenGLFunctions_3_2_Compatibility *f1 = context->versionFunctions<QOpenGLFunctions_3_2_Compatibility>(); version32Compatibility = f1; delete context; // 2.1 format.setMajorVersion( 3 ); format.setMinorVersion( 2 ); setFormat( format ); // Create an OpenGL context context = new QOpenGLContext; context->setFormat( format ); context->create(); context->makeCurrent(this); QOpenGLFunctions_2_1 *f2 = context->versionFunctions<QOpenGLFunctions_2_1>(); version32Core = f2; delete context; But that sometimes fails as well, on some Linux systems where I know that the system supports 3.2 + compatibility profile, I don't get the functions object either. What's the correct way to see which version is supported? Boudewijn _______________________________________________ Interest mailing list Interest@qt-project.org http://lists.qt-project.org/mailman/listinfo/interest