OpenGL and Specific Version Support

  • I have an application which makes use of the QOpenGLWidget.

    I've had reports back from customers that although the software runs (icon in the task bar) there is no display - the window is almost transparent. I've since narrowed this down to the version of OpenGL supported by the end users system but I would like to know:

    1. Is there any way of specifying a version of OpenGL to use in the application. For example, my development is running version 4.4 whereas one of the customers with this issue is only running 3.1. Obviously there are some OpenGL features not supported on the customers system.
    2. How can I determine which features are preventing correct operation of the application? Is it down to a single function call which may not be supported in earlier versions of OpenGL?

    Thanks in advance for any advice.

  • Hi!

    #include "mainwindow.h"
    #include <QApplication>
    #include <QSurfaceFormat>
    #include <QOpenGLContext>
    void setSurfaceFormat()
        QSurfaceFormat format;
    #ifdef QT_OPENGL_ES_2
        if (QOpenGLContext::openGLModuleType() == QOpenGLContext::LibGL) {
            format.setVersion(4, 3); // <-- the minimum version needed goes here
    int main(int argc, char *argv[])
        QApplication a(argc, argv);
        MainWindow w;;
        return a.exec();

  • @Wieland thanks for your solution. I will give your code a try now.

  • @Wieland Unfortunately this method doesn't seem to work. I used your code, changing the setVersion parameters to 3, 0 however the customer is still having issues with no OpenGL display.

    I've also tried a setVersion(2, 0) which doesn't work, setVersion(1,0) which also doesn't work either. On my local development machine with 4.4, all of the above work fine.

  • Lifetime Qt Champion


    Did you gather the specifics of your customer work station ?
    You might be hitting a driver issue.

Log in to reply