Jump to content
  • Advertisement

Archived

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

EasyGino

Index 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.

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

Recommended Posts

How does this "index" buffer differ from the traditional Vertex buffer? I''m looking to create a world like atmosphere and it would be a bit difficult using triangles to create everything I was reading through the DrunkenHyenas online tutorials, but couldn''t find anything that covered that.

Share this post


Link to post
Share on other sites
Advertisement
Index buffers are used with vertex buffers, so that a single vertex can be used multiple times during single draw call.
It doesn''t, therefore, replace the vertex buffers.

-Nik

Share this post


Link to post
Share on other sites
Nik! I expect more from you, where are your diagrams with the smiley faces Where are the examples!? LOL I''m slow, remember? :D

Share this post


Link to post
Share on other sites
I could explain a whole bunch of info on an index buffer here... but why not just show you the ultimate power of GOOGLE??!!!

I am assuming you are using d3d since you were looking at DrunkenHyenas tuts.

[edited by - curtmax_0 on October 16, 2003 11:46:13 AM]

Share this post


Link to post
Share on other sites
Why would I use google when we have a forum here? Why would anyone post anything here. You could find everything you ever needed on a search engine. But I come here for the advise and opinions of the individuals on this board, not to hear about people telling me to look elsewhere.

Share this post


Link to post
Share on other sites
Sorry, I was just pointing out, there are several tuts you can find which probably explain it well( with diagrams and all ), if you just search for them.

Share this post


Link to post
Share on other sites
Hi,

I couldn''t draw a diagram on this subject
However, i give an example.

Consider 4 vertices, numbered 0, 1, 2 and 3.
The vertice''s positions are assumed to be in clockwise order.

Now, how would you draw a quad (list of 2 triangles), with this data, without duplicating the actual vertices?

Answer: Make a index buffer the size of 6 indices.
The first triangle''s indices are 0, 1 and 2.
Second triangle''s indices are 0, 2 and 3.

Now, the vertices 0 and 2 get to be used twice in the same draw call. Because indices take much less space than vertices, this is a memory advantage.

Other, non-obvious effect of the indexing is that when a vertex gets thru the video card''s transformation stage, it is stored in a cache memory for a short while. If the same vertex is used while it''s transformed counterpart is in the cache, it doesn''t have to be transformed again.
This is a speed advantage, and usually a surprisingly significant one.

The single quad is too simple to benefit at all from indexing. But in real mesh, as many as 30% of the vertices may be used in more than one triangle.

-Nik

Share this post


Link to post
Share on other sites
See that sorta makes sense! Thanks Nik, you always help me out.


D3DVERTEX aCubeVertices[ ] = { {-1.0f,-1.0f,-1.0f,0.0f,1.0f},{-1.0f, 1.0f,-1.0f,0.0f,0.0f},{1.0f, 1.0f,-1.0f,1.0f,0.0f},
{ 1.0f,-1.0f,-1.0f,1.0f,1.0f},{-1.0f,-1.0f, 1.0f,0.0f,0.0f},{1.0f,-1.0f, 1.0f,0.0f,1.0f},
{ 1.0f, 1.0f, 1.0f,0.0f,0.0f},{-1.0f, 1.0f, 1.0f,0.0f,1.0f}};

short aCubeIndices[ ] = {0,1,2,2,3,0,4,5,6,6,7,4,0,3,5,5,4,0,3,2,6,6,5,3,2,1,7,7,6,2,1,0,4,4,7,1};


so these 8 Vertices are all referenced 0-8? and then in groups of 3 those Indices are applied to make a triangle!? Thats much easier.

[edited by - EasyGino on October 16, 2003 5:02:58 PM]

Share this post


Link to post
Share on other sites
A cube is an unfortunate shape for index buffering, since you still have to have duplicate vertices at the corners (because of different normals at each cube face).

However, i see that you got the basic idea though

-Nik

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!