wiki:QtWebKitWebGL

Version 14 (modified by jarkko.j.sakkinen@gmail.com, 13 years ago) (diff)

--

Overview

WebGL can be enabled by setting QWebSettings::WebGLEnabled in your application. In addition, QWebSettings::AcceleratedCompositingEnabled needs to be enabled. For performance reasons, at the moment WebGL is scoped to work only together with accelerated compositing. For the best performance, you should use QGraphicsWebView with QGLWidget viewport. With this configuration QtWebKit is able to texture map the WebGL canvas directly. Otherwise, it has to do expensive memory copying into canvas image buffer for each frame.

In order to compile the WebGL support, use the following command-line:

Tools/Scripts/build-webkit --qt --3d-canvas

For QtTestBrowser, use command-line options -graphicsbased -gl-viewport -webgl to enable WebGL.

LayoutTests for WebGL

Layout tests for WebGL work with QtWebKit:

  • LayoutTestsControllerQt has support for enforcing WebGL support in overridePreference(). This used by WebGL test cases to enable WebGL support.
  • DumpRenderTreeQt enables QGraphicsWebView for layout tests if environment variable QT_DRT_WEBVIEW_MODE is enabled.
  • Accelerated compositing is enabled by default in QWebSettings and DumpRenderTree does not touch to that option.

The correct command-line for running layout tests is

QT_DRT_WEBVIEW_MODE=graphics WebKitTools/Scripts/run-webkit-tests --qt

Some real-world test cases

Here are some pages that might be useful for testing:

Things left to do