From 9d7886d4561c1d45cfd4938b9f43f0c17f8a464a Mon Sep 17 00:00:00 2001 From: Laszlo Agocs <laszlo.agocs@qt.io> Date: Fri, 7 Feb 2020 16:58:58 +0100 Subject: [PATCH] examples: Make Underlay backgrounds identical With QSG_RHI=1 the scenegraph always clears when it starts the renderpass. It is no longer possible to circumvent this and QQuickWindow::setClearBeforeRendering() has no effect with the RHI rendering path, as documented. As a consequence, SceneEnvironment.clearColor is not used when the renderMode is not Offscreen. Therefore, the simplest solution to get the same results in Underlay View3Ds regardless of QSG_RHI is to use the same value both for Window.color and for SceneEnvironment.clearColor. Change-Id: Ie8040970ea32bea653babb47c1696148e425ed4a Reviewed-by: Andy Nichols <andy.nichols@qt.io> --- examples/quick3d/principledmaterial/main.qml | 4 ++-- examples/quick3d/view3d/main.qml | 3 ++- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/examples/quick3d/principledmaterial/main.qml b/examples/quick3d/principledmaterial/main.qml index b49131c39..a504612a6 100644 --- a/examples/quick3d/principledmaterial/main.qml +++ b/examples/quick3d/principledmaterial/main.qml @@ -58,6 +58,7 @@ Window { height: 720 visible: true title: "Principled Materials Example" + color: "#848895" MaterialControl { id: materialCtrl @@ -89,8 +90,7 @@ Window { //! [environment] environment: SceneEnvironment { probeBrightness: 250 - clearColor: "#848895" - + clearColor: window.color backgroundMode: SceneEnvironment.Color lightProbe: Texture { source: "maps/OpenfootageNET_garage-1024.hdr" diff --git a/examples/quick3d/view3d/main.qml b/examples/quick3d/view3d/main.qml index dafbe4edf..f7db0d21e 100644 --- a/examples/quick3d/view3d/main.qml +++ b/examples/quick3d/view3d/main.qml @@ -59,6 +59,7 @@ Window { height: 720 visible: true title: "View3Ds with Different Cameras" + color: "#848895" // The root scene //! [rootnode] @@ -225,7 +226,7 @@ Window { renderMode: View3D.Underlay environment: SceneEnvironment { - clearColor: "#848895" + clearColor: window.color backgroundMode: SceneEnvironment.Color } } -- GitLab