Installation Guide

The building of Qt Quick 2D Renderer is complicated by the fact that Qt Quick 2 always requires OpenGL support regardless of whether it is being used or not. You will need to build Qt with support for OpenGL even if the target system does not support it. If you have a Qt build that already supports OpenGL, you can skip to Building Qt Quick 2D Renderer.

Providing the OpenGL Dependency

Qt Quick 2D Renderer works in such a way that it renders the Qt Quick 2 scene graph with QPainter, instead of using hardware acceleration via the OpenGL API. However, Qt Quick 2 still assumes that OpenGL is always available. With Qt Quick 2D Renderer we can avoid making OpenGL calls, but that does not change the fact that QtQuick 2 requires the OpenGL development headers to be available at build-time and will link against OpenGL libraries at run-time.

The solution is to provide a dummy OpenGL library and development headers to build Qt against. In this way you can build Qt with virtual OpenGL support and get access to the QtQuick 2 APIs. You should have no problems using Qt Quick 2D Renderer provided that you use a platform plugin that does not make calls to EGL or OpenGL commands, and that you refrain from using APIs that access OpenGL directly.

How to use the OpenGL Dummy Libraries

The OpenGL dummy libraries provide both headers and shared object files containing the symbols for both OpenGL and EGL. The headers get copied into your INCLUDE path, and the shared object files get copied into your LIB path in both the sysroot, as well as in the target image distributed on the device. The library that is generated contains all the symbols needed to link an application as if you had support for OpenGL and EGL. It is important to make sure that you do not call any of these symbols in your application.

Prerequisites

Three elements are required:

  1. Toolchain to cross compile code for your device.
  2. Sysroot containing development headers and shared objects to link against when building applications.
  3. Target image intended to be deployed to your device.

How to build the OpenGL Dummy Libraries

Set up your build environment by defining where your compiler and sysroot are located:

export CC=/opt/arm-toolchain/usr/bin/arm-linux-gnueabi-g++
export SYSROOT=/opt/device-name/sysroot/

Run the build script inside the client-dummy directory:

cd client-dummy
./build-gcc.sh

That should generate two files: libEGL.so, libGLESv2.so

Installation of Files

Copy the include folder to the /usr/include folder in your sysroot. This installs the OpenGL/EGL headers:

cp -r 3rdparty/include/* ${SYSROOT}/usr/include/

Copy libEGL.so and libGLESv2.so to the /usr/lib folder in your sysroot:

cp src/lib*.so ${SYSROOT}/usr/lib/

Copy the libEGL.so and libGLESv2.so libraries to the target device image as well.

Building Qt

When configuring Qt, make sure to append -opengl es2 to your configure arguments.

Building Qt Quick 2D Renderer

Build Qt Quick 2D Renderer like any other Qt module:

qmake
make
make install

Deployment

Now, when you deploy your Qt build to the device, it will depend on the dummy libs libEGL.so and libGLESv2.so, but as long as you are using the Qt Quick 2D Renderer plugin you will be able to use Qt Quick 2 without actually making any OpenGL or EGL calls.

© 2016 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.