Jump to content
  • Advertisement


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


NumVertices of DrawIndexedPrimitive

This topic is 5627 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 don''t get what it says in the docs: MinIndex [in] Minimum vertex index for vertices used during this call. NumVertices [in] The number of vertices indexed during this call, starting from BaseVertexIndex + StartIndex StartIndex [in] Location in the index array to start reading indices. PrimitiveCount [in] Number of primitives to render. The number of vertices used is a function of the primitive count and the primitive type. The maximum number of primitives allowed is determined by checking the MaxPrimitiveCount member of the D3DCAPS8 structure. i get the number of primitives to render, and start index. my question is what is the difference bewteen start index and MinIndex, and in NumVertices when it says ''starting from BaseVertexIndex + StartIndex'', does that mean that you calculate it for example, a indexed triangle list like this: PrimitiveCount * 3 + StartIndex + BaseVertexIndex from SetIndices? if thats the case, why doesn''t direct3d do it internally? if not, how do you calculate it, and what does MinIndex do?

Share this post

Link to post
Share on other sites
MinIndex is the lowest vertex number in the index list you provided. It''s sole purpose is so that DX can start at this vertex rather than vertex 0 when transforming verts.

NumVertices is the number of vertices that need to be transformed to make this call work. ie: MaxVertexIndex in list - MinIndex(from above) + 1

StartIndex is the index from the stated beginning of your index buffer. If you did a SetIndices(60) and your first index used in this draw call is 63, you would pass 3. Assume this simple mesh is at IB index 63, but we created a lock for some meshes at IB index 60. When we do a lock call, and we write this mesh''s indices start at IB[3] from our lock pointer. We store this as our StartIndex of 3.

PrimitiveCount is the number of polys to draw

So, if I had an index buffer that contained the following at it''s 63rd entry:
IB@63 = 6, 8, 5, 8, 5, 9

SetIndices(pIB, 60);

MinIndex would be 5, it''s the smallest vertex number in the list.

NumVertices would be the largest vertex referenced minus the smallest vertex referenced, plus 1. (9-5+1) = 5. DX needs to transform 5,6,7,8, and 9 to make this work. It cannot skip unused values.

StartIndex would be 3, since we SetIndices at 60 and we''re trying to start at index 63.

PrimitiveCount = 2, we''re only drawing two triangles

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!