• ### Popular Now

• 15
• 15
• 11
• 9
• 10

#### Archived

This topic is now archived and is closed to further replies.

# Vertex buffer and Indexed Buffer

This topic is 5392 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## Recommended Posts

What is the different between them? I saw some article that say using vertex buffer to build a cube is difficult to indexed buffer, but I don''t know why? Can you describe more clearly? By the way, if the vertex buffer is not better than indexed buffer, therefore, did all game use indexed buffer instead of vertex buffer? The last question is what is the different between z-buffer and w-buffer, I still don''t understand? And how to create them through code? Thank you for you help ^__^

##### Share on other sites

Vertex buffers contain vertices.
Index buffers contain indices.
They are orthogonal concepts.

##### Share on other sites
An index buffer only sets the order how to render the vertexbuffer.
Example:
You want to render an object like this, which is built of 4 vertices and 2 polygons.

v1 x--x v2   |\ |   | \|v4 x--x v3

You could create only a vertexbuffer and fill 6 vertices in it to create 2 polys by connecting v1,v2,v3 and v3,v4,v1

Or you could use an indexbuffer and an vertexbuffer. So you would fill the vertexbuffer with the 4 vertices and you would fill the indexbuffer with the order to render.
So vertexbuffer would be filled with v1,v2,v3,v4
indexbuffer would be filled with 0,1,2,2,3,0

Both rendering would have the same results, but usually rendering with indexbuffers is much more faster, since less video memory is allocated (only 4BIG (+6 SMALL indices) instead of 6BIG vertices). Also the vertices only have to be transformed once per vertex, resulting in 4 vertex transformations by use of an vertex- and indexbuffer and 6 by use of only on vertex buffer.

[edited by - To_N on June 19, 2003 8:03:43 AM]