Congratulations to our 2022 Qt Champions!

How to force OpenGL (instead of OpenGL ES) on QQuickView + QTWebEngine?

  • I'm working on a kiosk system that has a full blown desktop GPU. I'm using QtWebEngine 1.5 on QtQuick 2.0

    It turns out that my web engine reports that it uses OpenGL ES 3.0 instead of OpenGl 3.0. Due to this fact there's no out of the box antialiasing and the performance is poor (I believe some operations normally supported by opengl are moved to the CPU which is weak on this box).

    I've already set the QT_LOGGING_RULES to confirm that OpenGL 3.0 is available but somehow opengl es is used by either qquick or qt web engine. What I've tried so far: qputenv("QT_OPENGL", "desktop"); and app.setAttribute(Qt::AA_UseDesktopOpenGL);

    Is there any way of explicitly telling QQuickView (or maybe qt web engine?) to use desktop implementation of OpenGL?

  • Moderators

    Compile Qt with -opengl desktop config flag.

  • Thanks for the response.

    It looks like QWebEngine explicitly passes the argument --use-gl=egl to QWebKit.

    How do I remove that default argument?

  • @sierdzio I've added

    QMAKE_CXXFLAGS += -opengl=desktop

    To pro file but with no luck. Got such an error:

    /var/jenkins_home/._nerves/artifacts/nerves_system_rzjb-portable-1.0.0/host/bin/x86_64-unknown-linux-gnu-g++ -pipe -D_LARGEFILE_SOURCE -D_LARGEFILE64_SOURCE -D_FILE_OFFSET_BITS=64 -Os --sysroot=/var/jenkins_home/._nerves/artifacts/nerves_system_rzjb-portable-1.0.0/host/x86_64-buildroot-linux-gnu/sysroot -opengl=desktop -O2 -O3 -Wall -W -dM -E -o _build/qt/moc_predefs.h ../../../../._nerves/artifacts/nerves_system_rzjb-portable-1.0.0/host/mkspecs/features/data/dummy.cpp
    cc1plus: error: output filename specified twice

  • Moderators

    That's wrong place to add it.

    You need to compile Qt (not your app) and pass -opengl desktop to configure script. Then once Qt is built, you'd need to compile your app normally (no extra flags necessary) using that Qt version.

  • Thanks @sierdzio!

Log in to reply