summaryrefslogtreecommitdiffstats
path: root/examples/qt3d/advancedcustommaterial
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2021-07-10 23:40:45 +0100
committerMike Krus <mike.krus@kdab.com>2021-07-19 16:14:26 +0100
commit3964b273459c2999f33d51b96afe6fb68f07d52f (patch)
tree06b8b71bc2100e5093bd79321b43d6d4e541492a /examples/qt3d/advancedcustommaterial
parent7f1f3c358258331f86dc792c653482c82bbf2ec6 (diff)
Disable RHI Renderer by default
RHI renderer use ShaderTools which is GPL licensed. This patch disables the plugin by default until Qt3D provides a suitable replacement for the dependency. To enable the RHI backend, compile Qt3D and pass parameter -DFEATURE_qt3d_rhi_renderer=ON to cmake. Unfortunate side effect of RHI backend being disabled is that when using Scene3D, the QtQuick renderer must be configured to use the opengl backend. [ChangeLog] RHI Backend is not longer built by default Task-number: QTBUG-94960 Pick-to: 6.1 6.2 Change-Id: I0bff7523e159b800734b58bfef37e5088d0a0d41 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
Diffstat (limited to 'examples/qt3d/advancedcustommaterial')
-rw-r--r--examples/qt3d/advancedcustommaterial/CMakeLists.txt2
-rw-r--r--examples/qt3d/advancedcustommaterial/main.cpp5
2 files changed, 7 insertions, 0 deletions
diff --git a/examples/qt3d/advancedcustommaterial/CMakeLists.txt b/examples/qt3d/advancedcustommaterial/CMakeLists.txt
index b06ec23a9..8bb9b6d1c 100644
--- a/examples/qt3d/advancedcustommaterial/CMakeLists.txt
+++ b/examples/qt3d/advancedcustommaterial/CMakeLists.txt
@@ -19,6 +19,7 @@ find_package(Qt6 COMPONENTS Core)
find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Qml)
find_package(Qt6 COMPONENTS Quick)
+find_package(Qt6 COMPONENTS 3DRender)
qt_add_executable(advancedcustommaterial
main.cpp
@@ -32,6 +33,7 @@ target_link_libraries(advancedcustommaterial PUBLIC
Qt::Gui
Qt::Qml
Qt::Quick
+ Qt::3DRender
)
diff --git a/examples/qt3d/advancedcustommaterial/main.cpp b/examples/qt3d/advancedcustommaterial/main.cpp
index eef254063..f402f4628 100644
--- a/examples/qt3d/advancedcustommaterial/main.cpp
+++ b/examples/qt3d/advancedcustommaterial/main.cpp
@@ -51,6 +51,7 @@
#include <QGuiApplication>
#include <QQuickView>
#include <QOpenGLContext>
+#include <Qt3DRender/qt3drender-config.h>
void setSurfaceFormat()
{
@@ -67,6 +68,10 @@ void setSurfaceFormat()
format.setSamples(4);
format.setStencilBufferSize(8);
QSurfaceFormat::setDefaultFormat(format);
+
+#if !QT_CONFIG(qt3d_rhi_renderer)
+ qputenv("QSG_RHI_BACKEND", "opengl");
+#endif
}
int main(int argc, char **argv)