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

Time for action – creating a 3D scene using C++

Let's see how we can recreate our first Qt 3D scene using only C++ code. Our scene will contain a light source, a cube, and a first person camera controller. You can use the Qt Console Application template to create the project. Don't forget to enable the Qt 3D modules you want to use in the project file:

QT += 3dextrasCONFIG += c++11

The first change compared to the QML approach is that you need to use the Qt3DWindow class instead of Qt3DQuickWindow. The Qt3DWindow class performs a few actions that are typically needed in a Qt 3D application. It sets up a QForwardRenderer, a camera, and initializes the QInputSettings object needed for processing events. You can access the default frame graph ...

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