WebGL not working



  • Hi,

    I am trying to use WebGL on a page in a QWebEngineView.

    When navigating in that widget to http://webglreport.com/ I am presented with the message "This browser supports WebGL 2, but it is disabled or unavailable.".

    When I try Three.js, I get these errors:
    Uncaught TypeError: Cannot read property 'getShaderPrecisionFormat' of null
    THREE.WebGLRenderer: Error creating WebGL context.

    Other than this error, the web engine works well, e.g. I can visit YouTube and watch videos, etc. I tried to explicitly enable WebGL in the web engine settings, but that didn't change anything (and the docs say, that it's enabled by default anyway).

    What do I miss? It's not easy to debug this.

    Thanks a lot,
    Stephan



  • I forgot to mention that the application I am working on uses desktop OpenGL.

    What seems to fail is that when a canvas element is asked for the webgl context, it returns null instead of [object WebGLRenderingContext] (which I get in the Chrome browser showing the same page).

    var canvas = $('#canv');
    var gl = canvas[0].getContext('webgl', { stencil: true });
    alert(gl); // null in QWebEngineView, [object WebGLRenderingContext] in Chrome browser


  • The recent blog post http://blog.qt.io/blog/2017/07/07/qt-webgl-streaming-merged/ contains this:
    "Since WebGL was modelled using OpenGLES2 as reference, first thing you will need is to have an OpenGLES2 version of Qt built."

    As I stated in my previous post here, my application is using Desktop OpenGL. Does this mean I cannot use WebGL?



  • I got help from Qt support and it's working now! I had to specify --ignore-gpu-blacklist on the commandline with my application linked against a Qt with normal desktop OpenGL. All is well! :D


Log in to reply
 

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