Quite often it is more convenient to reuse vertices stored in a vertex buffer. Like the corners of a cube which belong to multiple sides, vertices in arbitrary geometry may belong to many parts of the whole model.
Drawing the object one vertex after another would require us to store the same vertex (along with all its attributes) multiple times. A better solution is to indicate which vertices should be used for drawing, no matter how they are ordered in the vertex buffer. For this purpose, indexed drawing was introduced in the Vulkan API. To draw geometry using indices stored in an index buffer, we need to call the vkCmdDrawIndexed() function.
Drawing an indexed geometry
How to do it...
- Create a variable of type VkCommandBuffer named command_buffer, in which store...