The OpenVG adaptation is an alternative renderer for Qt Quick 2 that will renderer the contents of the scene graph using OpenVG commands to provide hardware-acclerated 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 defualt OpenGL Renderer, there is no built in support for acquiring an OpenVG context. This means that the renderer has the responsbility of requesting and managing the the current context. To do this EGL has to be used directly in the OpenVG renderer. This means that the OpenVG renderer is only usable with platform plugins that support creating QWindows with support for QSurfaceFormat::OpenVG . From this window, the renderer can get an EGLSurface which can be used with an EGLContext to render OpenVG 内容。
The OpenVG Renderer works by using the OpenVG API to send commands and data to a Vector GPU which will render the scenegraph in an accelerated manner, offloading graphics rendering from the CPU. Many operations like the rendering of rectangles and fonts glyphs ideal for OpenVG because these can be represented as paths which are stroked and filled. Rendering scenegraph items that would typically involve textures are handled in the OpenVG renderer by using VGImage. In addition when rendering to offscreen surfaces (like when using 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 will execute all OpenVG commands in a single thread.
见 Scene Graph page for more information on render loops
ShaderEffect components in QtQuick 2 can not be rendered by the OpenVG adaptation. While it is possible to user ShaderEffectSource and QML Item Layers (which are both offscreen surfaces), it is not actually 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. It may be possible however to take advantage of Image Filter operations in the OpenVG API to get similar effects to what is provided by ShaderEffects in custom items. To integrate custom OpenVG rendering, use QSGRenderNode in combination with QSGRendererInterface .
Qt Graphical Effects 使用 ShaderEffect items to render effects. If you use graphical effects from this module, then you should not hide the source item so that the original item can still be rendered.
It is not possible to render particle effects with the OpenVG adaptation. Whenever possible, remove particles completely from the scene. Otherwise they will still require some processing, even though they are not visible.
The text rendering with the OpenVG adaptation is based on rendering the glpyh paths, and does not use the distance fields technique used by the OpenGL backend.
The OpenVG API does not allow paths to be transformed with non-affine transforms, while it is possible with Qt Quick. This means that rendering components using paths like Rectangles and Text, when applying perspective transforms the OpenVG backend will first render to a VGImage before applying transformations. This uses more memory at runtime and is a slower path so avoid doing this if necessary.