Jump to content
  • Advertisement

Archived

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

johnnyBravo

Can someone explain variables in DrawIndexedPrimitive?

This topic is 5277 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

Hi im using
HRESULT DrawIndexedPrimitive(          D3DPRIMITIVETYPE Type,
    INT BaseVertexIndex,
    UINT MinIndex,
    UINT NumVertices,
    UINT StartIndex,
    UINT PrimitiveCount
);
what i dont understand is the settings for these two: BaseVertexIndex MinIndex Like the explanations from msdn are: BaseVertexIndex [in] Offset from the start of the index buffer to the first vertex index. MinIndex [in] Minimum vertex index for vertices used during this call. but i still dont get what they are saying thanks

Share this post


Link to post
Share on other sites
Advertisement
These allow you to keep more than one index list in the same index buffer, and allow you to tell the driver properties about each specific sub-index-list to allow it to optimize drawing.

Suppose your vertex index has space for 1000 indices.
Suppose you put 4 trees in this buffer, each with 250 indices, but different shape.
Suppose you want to draw the third tree (tree #2, if the first is #0).
Suppose the trees all have the same vertex list, i e the values of the indices for each of these "chunks" is in the range [0,250).
Then you'd pass "500" for the BaseVertexIndex, because you want to use the indices that are at offset 500-749.

Now, suppose you have two index lists ("subsets") for the tree in that chunk; the wood using indices in the vertex range [0,60) and the leaves using indices in the range [60,200). When you draw the leaves, you want to still set BaseVertexIndex to 500 (because that's the start of the indices you want to use in the index buffer) but you want to set MinVertexIndex to 60, because that's the lowest numbered index that will actually be used.

Getting all of these right will allow certain drivers on certain hardware to optimize drawing, sometimes dramatically.


[edited by - hplus0603 on June 3, 2004 10:32:31 PM]

Share this post


Link to post
Share on other sites
MinIndex is a hint that says that the lowest index value in your entire indices from the index buffer [for those that are used in that call] is that value ie:
index buffer =
[9,4,7,9,5,3,8] minindex would be 3 as this is the lowest value

BaseVertexIndex is an offset value that is applied both to minindex and to everyvalue in the index buffer. Using the above example if we used a BVI of 3 then the buffer would appear inside of DIP as:
BVI = 3
[12,7,10,12,8,6,11].

Note: you don't have to make any changes to the DIP arguments or to your index buffer to use the BVI offset. just set the BVI arg to the offset and DIP will automaticaly offset your minindex and index buffer values. This is handy if you use a buffer atlas, ie a whole bunch of meshes in one buffer. This way you don't have to manually offset all of your indices for each mesh, just use the BVI.

[edit] minor elaboration.

[edited by - SoulSpectre on June 3, 2004 10:54:30 PM]

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!