Qt Forum

    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Unsolved

    How can I get actual installed GL version (not GL version being used in current context)?

    QML and Qt Quick
    2
    2
    625
    Loading More Posts
    • 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.
    • C
      cscooper last edited by

      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

      1 Reply Last reply Reply Quote 0
      • I
        infinicat last edited by

        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());@

        1 Reply Last reply Reply Quote 0
        • First post
          Last post