Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

How can I enable WebGL in QWebEngine 5.9 under Windows?



  • I want to use WebGL in QtWebEngineWidgets.QWebEngineView under Windows with my Qt 5.9.2.

    But when I try to load webglreport.com, in QWebEngineView it tells me, that "This browser supports WebGL 2, but it is disabled or unavailable."

    How can I fix it?

    Here's my code:

    PyQt:

    import os, sys
    from PyQt5 import QtCore, QtGui, QtWidgets, QtWebEngineWidgets
    
    
    if __name__ == '__main__':
        app = QtWidgets.QApplication(sys.argv)
    
    
       # app.setAttribute(QtCore.Qt.AA_UseOpenGLES)  # nothing happens, you can comment it out
    
        view = QtWebEngineWidgets.QWebEngineView()
    
        # view.settings().setAttribute(QtWebEngineWidgets.QWebEngineSettings.WebGLEnabled, True) # does not help too = (((
    
        view.load(QtCore.QUrl("http://webglreport.com/?v=2"))
    
        view.show()
    
        sys.exit(app.exec_())
    
        # And here WebGL Report  will tell me: "This browser supports WebGL 2, but it is disabled or unavailable."
        # How can I cope with it???
    

    C++ Qt:

    #include <QApplication>
    #include <QtWebEngineWidgets/QWebEngineView>
    
    #include <QUrl>
    int main(int argc, char *argv[])
    {
        QApplication a(argc, argv);
        QWebEngineView view;
        view.load(QUrl("http://webglreport.com/"));
        view.show();
        return a.exec();
    }

Log in to reply