O'Reilly logo

Game Programming using Qt 5 Beginner's Guide - Second Edition by Lorenz Haas, Witold Wysota, Pavel Strakhov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Embedding a Qt 3D scene into a Qt Quick form

Now let's see how we can perform the opposite task. This approach is useful if your application is built mainly around Qt Quick. This means that you use the QQmlApplicationEngine class in the main() function, and the root object of your main.qml file is usually the Window object. It's very easy to extend your Qt Quick application with a bit of 3D action.

We could place all the code into the main.qml file, but it's more convenient to split it because setting up a 3D scene requires quite a bit of code. Let's say you have a file named My3DScene.qml that contains the usual content of a 3D scene:

Entity {    components: [        RenderSettings {            activeFrameGraph: ForwardRenderer { /*...*/ }, InputSettings {} ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required