How can I get actual installed GL version (not GL version being used in current context)?
-
For debugging I would like to know what GL is installed on the user's machine. I have a QQuickItem that reports the value of glGetString(GL_VERSION); on my machine it says "2.1.2 NVIDIA 304.117" but if I run glxinfo on the command-line it reports "4.2.0 NVIDIA 304.117".
Is there a way, inside Qt/Qml, to get the "4.2.0" value?
Thanks,
Chris -
This may not be the best way but what you could try to do is create an OpenGL context using a fake, high version and then check what was actually created.
In QOpenGLContext's docs:
"If the OpenGL implementation on your system does not support the requested version of OpenGL context, then QOpenGLContext will try to create the closest matching version."Example:
@QSurfaceFormat requestedFormat;
requestedFormat.setVersion( 99, 99 );QOpenGLContext* context = new QOpenGLContext;
context->setFormat( requestedFormat );
context->create();qDebug() << QString("Requested OpenGL version (%1.%2); Actual created version (%3.%4).").arg(requestedFormat.majorVersion()).arg(requestedFormat.minorVersion()).arg(context->format().majorVersion()).arg(context->format().minorVersion());@