4

I'm using QWebEngine to display some webpages. Unfortunately it uses OpenGL internally - which leads to a crash on some graphics adapters (one can see the driver-DLL as the reason for the crash easily). As a second caveat it is not possible to catch this crash by a try-catch-block.

So my question: how can one force QWebEngine to use software rendering only and to not to use OpenGL?

Thanks!

Elmi
  • 5,899
  • 15
  • 72
  • 143
  • Why not just compile a version of the Qt library without OpenGL? – Flovdis Mar 02 '16 at 13:15
  • @Flovdis If the feature is available somehow why would you compile a customized version of the Qt library? This is an insane overhead and if there is another way I sure will go for it instead of this. – rbaleksandar Mar 02 '16 at 13:22
  • @flovdis because this would force the whole Qt environment to use software rendering which is not intended. for my own OpenGL-based applications I can easily check if it works or not and avoid any of these functions, only QWebengine is stupid enough to assume everything is fine - which leads to a crash. so I only want qWebEngine to use software rendering but not all the other Qt application – Elmi Mar 03 '16 at 07:50

1 Answers1

4

I assume you're on Windows, and are using the official Qt binaries, and are using Qt 5.5 or newer. These allow to switch between Desktop OpenGL, ANGLE (Direct X) and software rasterization at runime.

It should be therefore enough to set the QT_OPENGL environment variable to either "angle" (to use the DirectX backend) or "desktop". To hardcode this you can set the Qt::AA_UseOpenGLES or Qt::AA_UseSoftwareOpenGL application attributes.

If you use WebEngine through Qt Quick, you can also use the Qt Quick 2D renderer.

kkoehne
  • 1,176
  • 9
  • 17
  • I'm on Windows, but Windows 7 Embedded - where the whole detection of graphics platform via Qt does not work (as I found out recently). And I'm working with self-compiled binaries (option -opengl dynamic). So I really would need an option to force just QWebEngine to software rendering, not the whole environment. – Elmi Mar 23 '16 at 12:05
  • @Elmi did you find a solution for this in the end? We have the same issue here, an OpenGL application that used to use WebKit to show a webpage. Moving to 5.6 requires to update to WebEngine but just creating a QWebPage, without even trying to load a page is causing a crash on some systems. I couldn't isolate what was the cause, we've had crashes on AMD and NVidia cards. Sometimes updating the graphics drivers solves the issue, sometimes not. Forcing *just QWebEngine* to use software rasterization sounds like a good idea. Any help very welcome... – Uflex Oct 12 '16 at 09:49
  • 1
    @Uflex unfortunately not, QWebEngine is an instable piece of crap, it is a shame it was released in this poor state... – Elmi Oct 17 '16 at 09:00
  • @Elmi it would seem that in our case we were just missing some dependencies. Running WinDeployQt showed the missing files. See [this thread](http://stackoverflow.com/a/35448081/831673) for more info. I'm not sure why it was working on some machines but not others though... – Uflex Oct 17 '16 at 11:03