Rendering an indexed geometry
In this section, you will learn to use the vkCmdDrawIndexed()
draw command. This command is used for drawing the index geometry.The vkCmdDrawIndexed()
API is an index buffer's draw command. In an index buffer, each vertex is represented using an index number. This fashion of representing mesh data requires less memory and storage space to represent connected meshes when the mesh has shared vertices (such as enclosed shapes).
For example, a square geometry rendered using two triangles shares two common vertices as shown in the following example; as you can see, the first and third vertices are repeated:
static const VertexWithColor squareData[] = { { -0.5f, 0.5f, 0.0f, 1.0f, 1.0f, 1.0f, 0.0f, 1.0 }, { 0.5f, 0.5f, 0.0f, ...
Get Learning Vulkan 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.