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
qt6-changes.qdoc
Go to the documentation of this file.
1// Copyright (C) 2020 The Qt Company Ltd.
2// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GFDL-1.3-no-invariants-only
3
4/*!
5 \page opengl-changes-qt6.html
6 \title Changes to Qt OpenGL
7 \ingroup changes-qt-5-to-6
8 \brief QOpenGL classes migrated, QOpenGLWidget class has been moved to Qt OpenGL Widgets.
9
10 Qt 6 is a result of the conscious effort to make the framework more
11 efficient and easy to use.
12
13 We try to maintain binary and source compatibility for all the public
14 APIs in each release. But some changes were inevitable in an effort to
15 make Qt a better framework.
16
17 In this topic we summarize those changes in \l{Qt OpenGL}, and provide
18 guidance to handle them.
19
20 \section1 Deprecated classes removed
21
22 The \l{Qt OpenGL} module was deprecated for the life time of Qt 5, and the
23 classes it contained have been removed in Qt 6.
24
25 This refers specifically to the classes prefixed by \c{QGL}.
26
27 \section1 QOpenGL classes migrated
28
29 In Qt 5, a replacement set of OpenGL-support classes were added to Qt Gui.
30 This was in order to support OpenGL as the cross-platform graphics API that
31 served as foundation for graphics in Qt.
32
33 In Qt 6, these have been migrated to the \l{Qt OpenGL} module. They are still
34 usable and fully supported for applications depending on OpenGL directly.
35 However, they are no longer considered foundational, since Qt has been extended
36 to support other graphics APIs in its foundation, such as Direct3D, Metal and
37 Vulkan.
38
39 Existing application code will largely continue working, but should now
40 include \l{Qt OpenGL} in project files, as well as include the headers if
41 these were previously included indirectly through Qt Gui.
42
43 \note A notable exception is \l QOpenGLContext, which still resides in
44 Qt Gui.
45
46 \section1 The QOpenGLWidgets class
47
48 Another exception is the \l QOpenGLWidget class. This has been moved to a new
49 module named \c{Qt OpenGL Widgets} and should be included from there.
50
51 \section1 Selecting the OpenGL backend for RHI
52
53 In addition to adjusting project files and including headers, the application
54 should also manually set the rendering backend to OpenGL in order to use
55 this functionality when working with Qt Quick. By default, Qt will use the most
56 appropriate graphics API on the target platform. See the
57 \l{Rendering via the Qt Rendering Hardware Interface}{RHI rendering documentation}
58 for more details.
59
60 \section1 Removal of ANGLE
61
62 On Windows, ANGLE, a third-party OpenGL ES to Direct 3D translator, is no
63 longer included in Qt 6. This means \c Qt::AA_UseOpenGLES and the
64 environment variable \c{QT_OPENGL=angle} no longer has any effect. In
65 dynamic OpenGL builds there is no automatic fallback to ANGLE in case
66 OpenGL-proper fails to initialize. For QWindow or QWidget based applications
67 using OpenGL directly, for example via QOpenGLWidget, this means that
68 OpenGL-proper is the only option at runtime. However, the use of a pure
69 software OpenGL implementation, such as Mesa llvmpipe that is shipped with
70 the pre-built Qt packages, is still available.
71
72 For Qt Quick and Qt Quick 3D applications, Qt 6 introduces support for
73 Direct 3D 11, Vulkan, and Metal, in addition to OpenGL. On Windows, Qt 6
74 defaults to Direct 3D, therefore the effect of the removal of ANGLE is
75 lessened by the addition of support to other graphics APIs.
76*/