• Advertisement

Archived

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

vertex buffer and index buffer?

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

If you intended to correct an error in the post then please contact us.

Recommended Posts

I am reading Focus on 2D in Direct3D right now, but I got confused with Vertex Buffer and Index Buffer. I pretty much understand what vertex buffers is, a collection of vertices that you want to render on the screen. But then, the author explains something about shared vertices. Like those in a rectangle, formed by 2 triangles, thus there are 6 vertices, but you only need 4 vertices. So, the author says:
quote:
Focus on 2D in Direct3D, page 51 Rather than fill the vertex buffer with six vertices with duplicates, you can put only four vertices into vertex buffer, and place six entries in the index buffer.
I look at the DirectX SDK tutorials, in Tutorial 2: Rendering Vertices. The tutorial uses vertex buffer with four vertices to draw a rectangle, but it does not use any index buffer. So..what''s the point of index buffer? If I can fill in vertex buffer with only four vertices, why should I fill index buffer with six vertices?
500

Share this post


Link to post
Share on other sites
Advertisement
Some primitive types (like fans and strips) share vertices. Although that''s good, indexed lists are often preferable because they don''t constrain you in the ways that list and fans constrain you.

Essentially, fans and strips share vertices that are ordered in certain ways in the vertex buffer. An index buffer allows you to point into the vertex buffer in arbitrary ways.

Author, "Real Time Rendering Tricks and Techniques in DirectX", "Focus on Curves and Surfaces"

Share this post


Link to post
Share on other sites
Here is an example and explanation of what index buffers are in relation to vertex buffers and what the advantages are such as reducing your vertex usage less stress on the video card such as a terrain mesh made up of thousands of vertices.

http://www.andypike.com/tutorials/directx8/008.asp

As well as other dX8 tutorials.

http://www.andypike.com/tutorials/directx8/

Doug

Share this post


Link to post
Share on other sites

  • Advertisement