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(); ...

Get Game Programming using Qt 5 Beginner's Guide - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.