Qt Quick OpenVG Adaptation#
The OpenVG adaptation is an alternative renderer for Qt Quick 2 that renders the contents of the scene graph using OpenVG commands to provide hardware accelerated 2D vector and raster graphics. Much like the Software Adaptation , some features and optimizations are no longer available. Most Qt Quick 2 applications will run without modification though any attempts to use unsupported features will be ignored.
Unlike the default OpenGL Renderer, there is no built-in support to acquire an OpenVG context. This means that the renderer is responsible for requesting and managing the the current context. To do this, you use EGL directly in the OpenVG renderer. Consequently, the OpenVG renderer can only be used with platform plugins that support creating QWindows with support for
OpenVG . From this window, the renderer can get an EGLSurface which can then be used with an EGLContext to render OpenVG content.
The OpenVG Renderer uses the OpenVG API to send commands and data to a Vector GPU that renders the scene graph in an accelerated manner, offloading graphics rendering from the CPU. Many operations like the rendering of rectangles and font glyphs are ideal for OpenVG because they can be represented as paths which are stroked and filled. Rendering scene graph items that would typically involve textures are handled in the OpenVG renderer using VGImage. Additionally, when you render to offscreen surfaces (like with Layers), the scene subtree is rendered to a VGImage which can be reused in the scene.
The OpenVG Renderer mirrors the behavior of the Basic render loop and it runs all OpenVG commands in a single thread.
For more information on render loops, see Qt Quick Scene Graph .
ShaderEffect components in QtQuick 2 can’t be rendered by the OpenVG adaptation. While it’s possible to use ShaderEffectSource and QML Item Layers (which are both offscreen surfaces), it’s not possible to apply shader effects to them via the ShaderEffect item. This is because OpenVG lacks an API for applying per vertex and per fragment shader operations. However, you may be able to take advantage of Image Filter operations in the OpenVG API to get effects that are similar to what ShaderEffects provides in custom items. To integrate custom OpenVG rendering, use
QSGRenderNode in combination with
It’s not possible to render particle effects with the OpenVG adaptation. Whenever possible, remove particles completely from the scene. Otherwise they’ll still require some processing, even though they are not visible.
Text rendering with the OpenVG adaptation is based on rendering the glyph paths, and doesn’t use the distance fields technique, unlike with the OpenGL backend.
The OpenVG API doesn’t allow paths to be transformed with non-affine transforms, but it’s possible with Qt Quick. Consquently, when you render components using paths like Rectangles and Text while applying perspective transforms, the OpenVG backend first renders to a VGImage before applying transformations. This behavior uses more memory at runtime and takes more time; avoid it if possible.