Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 132131b

Browse files
committed
Fix vkCmdDrawIndexed parameter explanation
1 parent 24a2165 commit 132131b

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

04_Vertex_buffers/03_Index_buffer.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ void initVulkan() {
6868
...
6969
createVertexBuffer();
7070
createIndexBuffer();
71-
...
71+
...
7272
}
7373
7474
void createIndexBuffer() {
@@ -126,12 +126,13 @@ vkCmdDrawIndexed(commandBuffers[i], indices.size(), 1, 0, 0, 0);
126126
```
127127

128128
A call to this function is very similar to `vkCmdDraw`. The first two parameters
129-
specify the number of indices and the number of vertices. The number of indices
130-
represents the number of vertices that will be passed to the vertex buffer. The
131-
next parameter specifies an offset into the index buffer, using a value of `1`
132-
would cause the graphics card to start reading at the second index. The second
133-
to last parameter specifies an offset to add to the indices in the index buffer.
134-
The final parameter specifies an offset for instancing, which we're not using.
129+
specify the number of indices and the number of instances. We're not using
130+
instancing, so just specify `1` instance. The number of indices represents the
131+
number of vertices that will be passed to the vertex buffer. The next parameter
132+
specifies an offset into the index buffer, using a value of `1` would cause the
133+
graphics card to start reading at the second index. The second to last parameter
134+
specifies an offset to add to the indices in the index buffer. The final
135+
parameter specifies an offset for instancing, which we're not using.
135136

136137
Now run your program and you should see the following:
137138

@@ -153,4 +154,4 @@ provided that their data is refreshed, of course. This is known as *aliasing*
153154
and some Vulkan functions have explicit flags to specify that you want to do
154155
this.
155156

156-
[Full code listing](/code/index_buffer.cpp)
157+
[Full code listing](/code/index_buffer.cpp)

0 commit comments

Comments
 (0)