Qt 3D Render C++ Classes | Qt 3D 6.4.3

- Qt 6.4
- Qt 3D
- Qt 3D Render C++ Classes
- Qt 6.4.3 Reference Documentation

# Qt 3D Render C++ Classes

The Qt 3D Render module contains functionality to support 2D and 3D rendering using Qt 3D. More...

This module was introduced in Qt 5.7.

## Namespaces

Qt3DRender | Contains classes that enable 2D and 3D rendering
Qt3DRender::Render | Namespace used for accessing the classes Renderer and QRenderPlugin

## Detailed Description

The Qt 3D Render module provides an aspect, components, and other supporting types necessary to implement 2D and 3D rendering as part of the Qt 3D framework.

To use classes from this module, add this directive into the C++ files:

     #include <Qt3DRender>

To link against the corresponding C++ library, add the following to your qmake project file:

     QT += 3drender

Classes, types, and functions are declared under the Qt3DRender namespace.

### Overview

The Qt 3D Render aspect offers support for data-driven configuration as described in Qt 3D Render Framegraph.

### Selecting a Rendering Backend

The Render aspect comes with two rendering backends.

- OpenGL backend (ES 2, ES 3.2, GL 2, GL 3, GL 3.2, GL 4.3)
- RHI backend (ES 2, GL, DirectX, Vulkan, Metal)

If you are targeting OpenGL exclusively and are using specific OpenGL features, you might be better off using the OpenGL backend. This is the OpenGL backend that Qt 3D exclusively used in the Qt 5 series.

For cases where you are not using specific OpenGL features and want to target different platforms that might have deprecated OpenGL, using the RHI backend is a better alternative.

To select your rendering backend, the environment variable QT3D_RENDERER is to be set to either "opengl" or "rhi". Defaults to the OpenGL backend.

When using the RHI backend, you can further force the internal RHI backend by setting the QSG_RHI_BACKEND to one of the following values:

- opengl -> RHI OpenGL backend
- gl -> RHI OpenGL backend
- gles2 -> RHI OpenGL backend
- metal -> RHI Metal backend
- vulkan -> RHI Vulkan backend
- d3d11 -> RHI DirectX 11 backend

If not specified, RHI will default to what it deduces to be the best backend for the platform.

### Reference

- Qt 3D Render C++ Classes
- Qt 3D Examples