Qt
Internal/Contributor docs for the Qt SDK. <b>Note:</b> These are NOT official API docs; those are found <a href='https://doc.qt.io/'>here</a>.
Loading...
Searching...
No Matches
qtquick3d-requirements.qdoc
Go to the documentation of this file.
1// Copyright (C) 2019 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5\page qtquick3d-requirements.html
6\title Qt Quick 3D Graphics Requirements
7\brief OpenGL requirements and considerations
8
9\section1 Supported graphics APIs, versions, and shading languages
10
11Qt Quick 3D supports operating with all the graphics APIs and shading languages
12supported by Qt Quick in Qt 6.0. In some cases, with OpenGL and OpenGL ES in
13particular, the version requirement may be higher for Qt Quick 3D than for Qt Quick.
14
15\list
16\li \l{https://www.khronos.org/opengl/}{OpenGL} 3.0 or higher; OpenGL 3.3 or higher is strongly recommended
17\li \l{https://www.khronos.org/opengles/}{OpenGL ES} 2.0 or higher; OpenGL ES 3.0 or higher is strongly recommended
18\li \l{https://docs.microsoft.com/en-us/windows/win32/direct3d11/atoc-dx-graphics-direct3d-11}{Direct3D 11.1}
19\li \l{https://learn.microsoft.com/en-us/windows/win32/direct3d12/what-is-directx-12-}{Direct3D 12}
20\li \l{https://www.khronos.org/vulkan/}{Vulkan} 1.0 or higher
21\li \l{https://developer.apple.com/metal/}{Metal} 1.2 or higher
22\endlist
23
24The shader pipeline is based on the standard approach of Qt 6: Vulkan-compatible
25GLSL shader code is compiled to SPIR-V, which is then translated to GLSL, HLSL,
26and MSL source code. Refer to the \l{Qt Shader Tools} module documentation for
27details.
28
29Qt Quick 3D does not directly work with any of the graphics APIs mentioned
30above. Rather, it uses the Qt Rendering Hardware Interface abstractions,
31similarly to Qt Quick.
32
33\section2 Choosing the graphics API
34
35As Qt Quick 3D does not initialize rendering or a window on its own, but rather
36relies on \l QQuickWindow or \l QQuickView or the \l Window QML type, everything
37related to graphics API selection that applies to the
38\l{qtquick-visualcanvas-scenegraph.html}{Qt Quick Scene Graph} applies to Qt
39Quick 3D as well. It is possible to control the behavior of the scene graph by
40setting specific environment variables as listed below:
41
42\table 100%
43\header
44 \li Environment Variable
45 \li Possible Values
46 \li Description
47
48 \row
49 \li \c QSG_RHI_BACKEND
50 \li \c vulkan, \c metal, \c opengl, \c d3d11, \c d3d12
51 \li Requests the specific RHI backend. By default the targeted graphics API
52 is chosen based on the platform, unless overridden by this variable or the
53 equivalent C++ APIs. The defaults are currently Direct3D 11 for Windows,
54 Metal for macOS, OpenGL elsewhere.
55
56 \row
57 \li \c QSG_RHI_DEBUG_LAYER
58 \li \c 1
59 \li Where applicable (Vulkan, Direct3D), enables the graphics API implementation's debug
60 and/or validation layers, if available.
61
62 \row
63 \li \c QSG_INFO
64 \li \c 1
65 \li Like with the OpenGL-based rendering path, setting this enables printing system
66 information when initializing the Qt Quick scene graph. This can be very useful for
67 troubleshooting.
68\endtable
69
70Applications wishing to always run with a single given graphics API can request
71this via the \c QSG_RHI_BACKEND enivronment variable, as well as with C++. For
72example, the following call made early in \c main(), before constructing any
73QQuickWindow, forces the use of Vulkan (and will fail otherwise).
74
75\code
76 QQuickWindow::setGraphicsApi(QSGRendererInterface::Vulkan);
77\endcode
78
79\note The \l{qtquick-visualcanvas-adaptations-software.html}{software
80adaptation} of Qt Quick is not supported for 3D content.
81
82\section2 OpenGL specifics
83
84Well written Qt Quick 3D applications are expected to call
85\l{QQuick3D::idealSurfaceFormat()} in their main() function, and use the
86returned QSurfaceFormat as the default:
87
88\code
89 QSurfaceFormat::setDefaultFormat(QQuick3D::idealSurfaceFormat());
90\endcode
91
92Calling this has no effect when a graphics API other than OpenGL is used, but is
93highly beneficial when the API is OpenGL as it will lead to creating an OpenGL
94context that is best suited for Qt Quick 3D's needs.
95
96\section2 OpenGL ES 2.0 support
97
98Qt Quick 3D supports running on OpenGL ES 2.0, but with a significantly limited
99feature set. The following list contains some of the features that will be
100unavailable or disfunctional:
101
102\list
103\li Image based lighting, light probes, skybox
104\li Shadow mapping
105\li Screen space ambient occlusion
106\li Multisampling
107\li Certain post-processing effects
108\li Custom materials that use shaders relying on GLSL features not present in GLSL ES 100
109\endlist
110*/