Clearing the background color
In this section, we use the created Render Pass and framebuffer object and implement the Render Pass instance. This Render Pass instance is very simple and will only clear the background image with a specified color. For each swapchain image, different colors can be specified using the pClearValues
field of the VkRenderPassBeginInfo
structure; this structure is then passed to the Render Pass instance.
The Render Pass instance is implemented during the preparation stage in which the command buffers are created. For each swapchain image, a corresponding command buffer object is created. This means, for n swapchain images, we need to create n command buffer objects.
The preparation is done using the VulkanDrawable::prepare()
function, and the rendering of the swapchain images will be performed using the VulkanDrawable::render()
function.
The following diagram shows the call stack of the prepare()
and render()
function:
The following class declaration shows the new...