Can not set renderable type from OpenGLES to OpenGL in Qt 5.7.0



  • Hi,

    I have worked on a project which used Qt 5.4.1 with OpenGL, here is the installer which i installed earlier:
    qt-opensource-windows-x86-msvc2013_opengl-5.4.1.exe

    After, we have done an upgrade from Qt 5.4.1 to Qt 5.7.0, so i installed this package:
    qt-opensource-windows-x86-msvc2013-5.7.0.exe

    On this project, we use OpenGL shared context too, which is works perfectly under Qt 5.4.1.
    After upgade to Qt 5.7.0, we got unexpected errors.

    The main problem is: i can not set individual QSurfaceFormat for QOpenGLContext. I would like to use OpenGL as RenderableType.
    So, i create a QSurfaceFormat, and passed to to QOpenGLContext::setFormat().

    QSurfaceFormat format;
    format.setVersion(2, 0); // OpenGL 2.0
    format.setProfile(QSurfaceFormat::CoreProfile);
    format.setRenderableType(QSurfaceFormat::RenderableType::OpenGL);
    
    QOpenGLContext *shareContext = QOpenGLContext::globalShareContext();
    
    shareContext->isOpenGLES(); // true
    shareContext->format().version(); // QPair(2,0) -> OpenGL 2.0
    shareContext->format().renderableType(); // 2 -> QSurfaceFormat::RenderableType::OpenGLES
    
    shareContext->setFormat(glFormat);
    shareContext->create();
    
    shareContext->isOpenGLES(); // true
    shareContext->format().version(); // QPair(2,0) -> OpenGL 2.0
    shareContext->format().renderableType(); // 2 -> QSurfaceFormat::RenderableType::OpenGLES
    

    What is the problem?
    It is like, there is a global setting to RenderableType as OpenGLES.
    How can i set to OpenGL?

    Thanks in advance,
    Peter


  • Lifetime Qt Champion

    Hi,

    Since 5.5 the backend selection is dynamic. You can however influence its behavior. See here for more information.



  • Hi @SGaist, thanks for your reply.

    I think i found the solution. Qt::AA_UseDesktopOpenGL and Qt::AA_ShareOpenGLContexts attributes solved my problem.


  • Lifetime Qt Champion

    Good !

    Then please mark the thread as solved using the "Topic Tools" button so that other forum users may know a solution has been found :)


Log in to reply
 

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