Whats the use of Vertex Buffer.

Started by
1 comment, last by Metolo 24 years, 1 month ago
The vertex buffer stores the vertex data. ... ... Is that it? Why would directx need a entirely new interface for storing vertecies? (erm what is the plural from of vertex?)
Advertisement
Yes the vertex buffer is used to store vertices. The vertex buffer lets triangles share vertices without the need for triangle fans or strips. This can greatly enhance the speed of your application when rendering lots of triangles as the vertices are only transformed and lit once.

The new interface is needed because it lets directX assign more properties to the vertices that are invisible to the developer. One such attribute is the clip flag, that tells if the vertex is clipped or not. The interface can also speed up the rendering as DrawIndexedPrimitive() can safely return before the call is finished rendering without DirectX having to worry about the developer changing the properties of the vertices as it is reading them.

(Short answer: they are good, they are fast, use them )
Vertex buffers have two uses:

Cache for static vertex information.

High speed vertex stream.


For static data, you can have a vertex buffer, Optimize() it to rearrange it for better performance, specific to the card/processor, and place it in the best memory location for highest performance. As an example, on a HW TnL device, you can place the untransformed vertex buffer in video memory. This way, the vertex data won''t have to be repeatedly sent over the bus.

Alternatively, you can use it for dynamic data, and smartly use the DISCARDCONTENTS and NOOVERWRITE flags in Lock() to stream the vertex data quickly to the card.

This topic is closed to new replies.

Advertisement