Understanding Qt's graphics framework
Qt is one of the most popular frameworks for GUI applications. Developers can build awesome cross-platform GUI applications using Qt without worrying about the underlying graphics implementation. The Qt Rendering Hardware Interface (RHI) interprets graphics instructions from Qt applications to the available graphics APIs on the target platform.
RHI is the abstract interface for hardware-accelerated graphics APIs. The most important class in the rhi
module is QRhi
. The QRhi
instance is supported by a backend for the specific graphics API. The selection of the backend occurs at runtime and is decided by the application or library that creates the QRhi
instance. You can add the module by adding the following line into your project file:
QT += rhi
Different types of graphics APIs supported by RHI are as follows:
- OpenGL
- OpenGL ES
- Vulkan
- Direct3D
- Metal
Figure 8.1 shows the major layers of the graphics stack...