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 the minimal Vulkan project

We've already created a project while testing the developing environment. Now let's add two new classes to the project. One class named MyWindow should be derived from QVulkanWindow, and the other class named MyRenderer should be derived from QVulkanWindowRenderer. Implement the window's createRenderer() virtual function:

QVulkanWindowRenderer *MyWindow::createRenderer() {    return new MyRenderer(this);}

Add the QVulkanWindow *m_window private field to the renderer class. Implement the constructor to initialize this field and override the startNextFrame() virtual function, as shown:

MyRenderer::MyRenderer(QVulkanWindow *window){    m_window = window;}void MyRenderer::startNextFrame() { m_window->frameReady(); ...

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