import QtQuick 2.14 import QtQuick.Window 2.14 import QtQuick3D 1.0 Window { visible: true width: 640 height: 480 title: qsTr("Hello World") color: "black" //color: "#606060" Rectangle { anchors.left: parent.left anchors.top: parent.top anchors.margins: parent.height * 0.05 width: parent.width * 0.4 height: parent.height* 0.4 border.color: "#ff4040" border.width: 2 Text { anchors.centerIn: parent text: "Visible:" + view3D.visible } MouseArea { anchors.fill: parent onClicked: { view3D.visible = !view3D.visible; } } } View3D { id: view3D anchors.centerIn: parent width: 400 height: 400 //renderMode: View3D.Offscreen //renderMode: View3D.Underlay renderMode: View3D.Overlay //visible: false //camera: perspectiveCamera /* environment: SceneEnvironment { clearColor: "#848895" backgroundMode: SceneEnvironment.Color } */ Node { id: scene DirectionalLight { id: directionalLight } PerspectiveCamera { id: perspectiveCamera z: -350 //visible: false } Model { id: cubeModel rotation.y: 45 rotation.x: 30 scale: Qt.vector3d(2,2,2) DefaultMaterial { id: cubeMaterial diffuseColor: "#4aee45" } materials: cubeMaterial source: "#Cube" } } } Rectangle { anchors.left: parent.left anchors.bottom: parent.bottom anchors.margins: parent.height * 0.05 width: parent.width * 0.4 height: parent.height* 0.4 border.color: "#ff4040" border.width: 2 Text { anchors.centerIn: parent text: "Mode:" + view3D.renderMode } MouseArea { anchors.fill: parent onClicked: { //view3D.renderMode = (view3D.renderMode == View3D.Underlay) ? View3D.Overlay : View3D.Underlay; view3D.renderMode = (view3D.renderMode == View3D.Underlay) ? View3D.Offscreen : View3D.Underlay; } } } }