Can't get OpenGL version higher than 1.1 on some Win10



  • I am trying to figure out how to assure that my OpenGL desktop application runs on modern Windows computers. The application is built with Qt5.6.2 with an expectation that ANGLE will take care of emulating OpenGL when necessary.

    Before constructing my application I call

    QCoreApplication::setAttribute(Qt::AA_UseDesktopOpenGL);
    

    My application window (canvas) derives from QOpenGLWindow. In its constructor, I set surface format to

    format.setProfile(QSurfaceFormat::OpenGLContextProfile::CompatibilityProfile);
    format.setRenderableType(QSurfaceFormat::RenderableType::OpenGL);
    

    I don't set OpenGL version and if I check it then the format returns the default GL version 2.0

    I also have a helper class (GLPainter) that is owned by my canvas window and derives from QOpenGLFunctions. When Qt calls initializeGL for my window I do initialization of the helper.

    GLPainter::initialize() 
    {
      canvas()->makeCurrent();
      initializeOpenGLFunctions();
    }
    

    Interesting things happen after a call to makeCurrent(). If I check gl versions using

     QOpenGLContext::currentContext()->format()
    

    on my development machine I would get 4.3 and glGetString(GL_VERSION) after initializeOpenGLFunctions() returns 4.3 as well (note that gl canvas format is still 2.0). My application works okay on my machine.

    I made an installer that includes everything indicated by windeployqt tool. Resulting installer runs okay but the application would not run on some computers. By adding diagnostic print statements I discovered that on those computers my canvas()->format() still reports 2.0 but QOpenGLContext::currentContext()->format() is 1.1 and correspondently openGL functions are limited to 1.1 only and as a consequence the application would not run. The troubled computer is a 64bit Windows 10 and it has DirectX 12.

    I don't know enough to make further progress and would appreciate suggestions.


  • Lifetime Qt Champion

    Hi,

    AFAIK, if you set the AA_UseDesktopOpenGL attribute, you are short-circuiting the dynamic OpenGL backend selection so you won't have ANGLE kicking in.



  • @SGaist Thanks for your response. Does it mean that on some computers (graphics cards) I would not get features of OpenGL 2.0?

    If the answer is yes then how do I check for this situation and possibly switch to a software implementation of OpenGL (I can live within confinements of 2.0)


  • Lifetime Qt Champion

    It's unlikely but not impossible however that would be really old hardware.

    What are the specs of the machine you have that situation on ?

    Note that you should also ensure to have proper graphic card driver installed.


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.