summaryrefslogtreecommitdiffstats
path: root/examples/qt3d
diff options
context:
space:
mode:
authorMike Krus <mike.krus@kdab.com>2021-07-10 23:40:45 +0100
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2021-07-19 17:09:15 +0000
commit61058758ab8621c67e62902244bea9253d0517b4 (patch)
tree59e0cbe985877e8a355341b28e67456c61a7d17f /examples/qt3d
parent8d82331da9ccbca9e3cc4b7d8a952d855b1e525d (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 Change-Id: I0bff7523e159b800734b58bfef37e5088d0a0d41 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> (cherry picked from commit 3964b273459c2999f33d51b96afe6fb68f07d52f) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
Diffstat (limited to 'examples/qt3d')
-rw-r--r--examples/qt3d/advancedcustommaterial/CMakeLists.txt2
-rw-r--r--examples/qt3d/advancedcustommaterial/main.cpp5
-rw-r--r--examples/qt3d/compute-particles/main.cpp5
-rw-r--r--examples/qt3d/controls/CMakeLists.txt2
-rw-r--r--examples/qt3d/controls/main.cpp4
-rw-r--r--examples/qt3d/controlsunderlay/CMakeLists.txt2
-rw-r--r--examples/qt3d/controlsunderlay/main.cpp4
-rw-r--r--examples/qt3d/planets-qml/main.cpp5
-rw-r--r--examples/qt3d/scene3d/CMakeLists.txt2
-rw-r--r--examples/qt3d/scene3d/main.cpp8
-rw-r--r--examples/qt3d/simplecustommaterial/CMakeLists.txt2
-rw-r--r--examples/qt3d/simplecustommaterial/main.cpp5
12 files changed, 46 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)
diff --git a/examples/qt3d/compute-particles/main.cpp b/examples/qt3d/compute-particles/main.cpp
index 66cd82ff9..ad6e563ea 100644
--- a/examples/qt3d/compute-particles/main.cpp
+++ b/examples/qt3d/compute-particles/main.cpp
@@ -50,11 +50,16 @@
#include <QGuiApplication>
#include <QQuickView>
+#include <Qt3DRender/qt3drender-config.h>
int main(int argc, char* argv[])
{
QGuiApplication app(argc, argv);
+#if !QT_CONFIG(qt3d_rhi_renderer)
+ qputenv("QSG_RHI_BACKEND", "opengl");
+#endif
+
QQuickView view;
view.resize(500, 500);
diff --git a/examples/qt3d/controls/CMakeLists.txt b/examples/qt3d/controls/CMakeLists.txt
index 07550ab21..f7c8ba115 100644
--- a/examples/qt3d/controls/CMakeLists.txt
+++ b/examples/qt3d/controls/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(controls
main.cpp
@@ -32,6 +33,7 @@ target_link_libraries(controls PUBLIC
Qt::Gui
Qt::Qml
Qt::Quick
+ Qt::3DRender
)
diff --git a/examples/qt3d/controls/main.cpp b/examples/qt3d/controls/main.cpp
index b5e448538..d2cca5bb5 100644
--- a/examples/qt3d/controls/main.cpp
+++ b/examples/qt3d/controls/main.cpp
@@ -50,10 +50,14 @@
#include <QGuiApplication>
#include <QQuickView>
+#include <Qt3DRender/qt3drender-config.h>
int main(int argc, char **argv)
{
QGuiApplication app(argc, argv);
+#if !QT_CONFIG(qt3d_rhi_renderer)
+ qputenv("QSG_RHI_BACKEND", "opengl");
+#endif
QQuickView view;
diff --git a/examples/qt3d/controlsunderlay/CMakeLists.txt b/examples/qt3d/controlsunderlay/CMakeLists.txt
index 1b65bc755..4bd5f086e 100644
--- a/examples/qt3d/controlsunderlay/CMakeLists.txt
+++ b/examples/qt3d/controlsunderlay/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(controlsunderlay
main.cpp
@@ -32,6 +33,7 @@ target_link_libraries(controlsunderlay PUBLIC
Qt::Gui
Qt::Qml
Qt::Quick
+ Qt::3DRender
)
diff --git a/examples/qt3d/controlsunderlay/main.cpp b/examples/qt3d/controlsunderlay/main.cpp
index cb3928a51..a19464911 100644
--- a/examples/qt3d/controlsunderlay/main.cpp
+++ b/examples/qt3d/controlsunderlay/main.cpp
@@ -50,12 +50,16 @@
#include <QGuiApplication>
#include <QQuickView>
+#include <Qt3DRender/qt3drender-config.h>
int main(int argc, char **argv)
{
QSurfaceFormat format;
format.setSamples(4);
QSurfaceFormat::setDefaultFormat(format);
+#if !QT_CONFIG(qt3d_rhi_renderer)
+ qputenv("QSG_RHI_BACKEND", "opengl");
+#endif
QGuiApplication app(argc, argv);
diff --git a/examples/qt3d/planets-qml/main.cpp b/examples/qt3d/planets-qml/main.cpp
index 32fca3136..da1335f80 100644
--- a/examples/qt3d/planets-qml/main.cpp
+++ b/examples/qt3d/planets-qml/main.cpp
@@ -52,6 +52,8 @@
#include <QQuickView>
#include <QQmlContext>
#include <QOpenGLContext>
+#include <Qt3DRender/qt3drender-config.h>
+
#include "networkcontroller.h"
int main(int argc, char **argv)
@@ -66,6 +68,9 @@ int main(int argc, char **argv)
format.setDepthBufferSize(24);
format.setStencilBufferSize(8);
format.setSamples(4);
+#if !QT_CONFIG(qt3d_rhi_renderer)
+ qputenv("QSG_RHI_BACKEND", "opengl");
+#endif
NetworkController networkController;
diff --git a/examples/qt3d/scene3d/CMakeLists.txt b/examples/qt3d/scene3d/CMakeLists.txt
index baefd34d5..5afe7b3d3 100644
--- a/examples/qt3d/scene3d/CMakeLists.txt
+++ b/examples/qt3d/scene3d/CMakeLists.txt
@@ -20,6 +20,7 @@ find_package(Qt6 COMPONENTS Gui)
find_package(Qt6 COMPONENTS Qml)
find_package(Qt6 COMPONENTS Quick)
find_package(Qt6 COMPONENTS 3DInput)
+find_package(Qt6 COMPONENTS 3DRender)
qt_add_executable(scene3d
main.cpp
@@ -30,6 +31,7 @@ set_target_properties(scene3d PROPERTIES
)
target_link_libraries(scene3d PUBLIC
Qt::3DInput
+ Qt::3DRender
Qt::Core
Qt::Gui
Qt::Qml
diff --git a/examples/qt3d/scene3d/main.cpp b/examples/qt3d/scene3d/main.cpp
index f4f01a7ea..23be5e2c0 100644
--- a/examples/qt3d/scene3d/main.cpp
+++ b/examples/qt3d/scene3d/main.cpp
@@ -51,6 +51,9 @@
#include <QGuiApplication>
#include <QQuickView>
+#include <Qt3DRender/qt3drender-config.h>
+
+
int main(int argc, char **argv)
{
{
@@ -67,6 +70,11 @@ int main(int argc, char **argv)
#endif
QSurfaceFormat::setDefaultFormat(format);
}
+
+#if !QT_CONFIG(qt3d_rhi_renderer)
+ qputenv("QSG_RHI_BACKEND", "opengl");
+#endif
+
QGuiApplication app(argc, argv);
// Force OpenGL backend
diff --git a/examples/qt3d/simplecustommaterial/CMakeLists.txt b/examples/qt3d/simplecustommaterial/CMakeLists.txt
index 0cf3c886f..590977956 100644
--- a/examples/qt3d/simplecustommaterial/CMakeLists.txt
+++ b/examples/qt3d/simplecustommaterial/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(simplecustommaterial
main.cpp
@@ -32,6 +33,7 @@ target_link_libraries(simplecustommaterial PUBLIC
Qt::Gui
Qt::Qml
Qt::Quick
+ Qt::3DRender
)
diff --git a/examples/qt3d/simplecustommaterial/main.cpp b/examples/qt3d/simplecustommaterial/main.cpp
index da299e913..beb00b7b3 100644
--- a/examples/qt3d/simplecustommaterial/main.cpp
+++ b/examples/qt3d/simplecustommaterial/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)