Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Save more on your purchases now! discount-offer-chevron-icon
Savings automatically calculated. No voucher code required.
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Learning Vulkan

You're reading from   Learning Vulkan Get introduced to the next generation graphics API—Vulkan

Arrow left icon
Product type Paperback
Published in Dec 2016
Publisher Packt
ISBN-13 9781786469809
Length 466 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Parminder Singh Parminder Singh
Author Profile Icon Parminder Singh
Parminder Singh
Arrow right icon
View More author details
Toc

Table of Contents (12) Chapters Close

Preface 1. Getting Started with the NextGen 3D Graphics API FREE CHAPTER 2. Your First Vulkan Pseudo Program 3. Shaking Hands with the Device 4. Debugging in Vulkan 5. Command Buffer and Memory Management in Vulkan 6. Allocating Image Resources and Building a Swapchain with WSI 7. Buffer Resource, Render Pass, Framebuffer, and Shaders with SPIR-V 8. Pipelines and Pipeline State Management 9. Drawing Objects 10. Descriptors and Push Constant 11. Drawing Textures

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...

lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime