Sign in to follow this  
Kurt-olsson

Have i understood index-buffers?

Recommended Posts

I have a question about index-buffers.

Is this correct?

1, Indexbuffers are used so that you can draw portions of the vertex-buffers instead of every vertex of the total vertex-buffer
2, if you need to update your vertex-buffers all the time, you dont need index-buffer (since everything is redrawn)
3, if you have a static house rendered with vertex-buffer, use index-buffer to draw all the buffers except the house on every frame

I normaly create a vertex-buffer for each of my geometry and then on frame_render i ->unmap copy ->map
i don+t use index-buffers.

is this the correct way to do it?

have i understood index-buffers correct?

Share this post


Link to post
Share on other sites
Index buffers are used to reduce the size of a vertex buffer. Vertices might be part of multiple adjacent triangles. You can either use triangle strips or triangle fans if you want to be able to use them for multiple triangles. But sometimes it's hard if not impossible to construct a model out of triangle strips or triangle fans. That's when you use a vertex list instead and use an index buffer to tell the graphics card which vertices form a triangle. This way it's easy to use vertices for multiple triangles. Also only the indices in the index buffer are redundant and not the vertices which require in most cases more memory than the indices.

But you might also use them to render only portions of a vertex buffer, as you said. You could also use the parameters IndexCount, StartIndexLocation and BaseVertexLocation of the DrawIndexed method to specify which parts of the index buffer and vertex buffer to render. Edited by CryZe

Share this post


Link to post
Share on other sites
[quote name='CryZe' timestamp='1348215104' post='4982276']
Index buffers are used to reduce the size of a vertex buffer.
[/quote]
Additional to that, a indexbuffer, more general indexed vertices, helps performance, because already transformed vertices are cached and follow up vertex transforms which targets the same index don't need to execute the vertex shader again, if it already exists in the cache.

Share this post


Link to post
Share on other sites
Hm. it looks like i have to laborate some to get full understanding. But this line makes me understand a bit:Index buffers are used to reduce the size of a vertex buffer

it is optimization that cut off the overhead that vertexbuffers have.


By the way, i noticed last night that DX11 can render pointlist with just one pixel, didnt get this to work with DX9. How cool is this!!! i am going to create particles effect the whole weekend! and this without using any sprites textures!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this