Jump to content
  • Advertisement


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



This topic is 5554 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''m programming my own game engine using DirectX 9, and i want to use animations in my engine. I don''t want to use bones etc, but a different set of models, which are drawn one after an other. I want to store 1 model (all the animation frame of 1 game object) in 1 vertex + 1 index buffer by using the DrawIndexedPrimitives function. But i get a error when drawing the animation. The DirectX 9 SDK help file is not clear about how to use the function exactly (parameters). So, which parameter is for what?

Share this post

Link to post
Share on other sites
I agree. The documentation for the DrawIndexedPrimitive function arguments is extremely unclear.

It took a lot of research to figure it out. The confusion was started when the BaseVertexIndex parameter in the SetIndices function in DX 8 was moved to DrawIndexedPrimitive in DX 9. Another problem is that "index" means one thing for one parameter and something different for another. And finally, it doesn''t explain what a "primitive" is.

This should clear it up (hopefully):

BaseVertexIndex - this parameter tells which vertex in the vertex buffer is vertex 0 for this call. This allows you to put multiple meshes in one vertex buffer and re-use index buffers. It should have been named "BaseVertex" or perhaps "IndexOfBaseVertex".

MinIndex - You might not use every vertex in the the vertex buffer. This parameter is the lowest value that any index in the index buffer will have for this call. It should have been named "MinIndexValue" or "MinVertex".

NumVertices - You might not use every vertex in the vertex buffer. This parameter tells how many vertices should be processed. This and MinIndex tell the hardware the range of vertices that will be used in this call (effectively NumVertices vertices starting with the vertex at MinIndex+BaseVertexIndex).

StartIndex - this is the starting index in the index buffer for this call. For example, if the value is 10, then DrawIndexedPrimitive will skip the first 10 indexes in the index buffer.

PrimitiveCount - this is the number of points in a point list, lines in a line strip or list, or triangles in a triangle list, strip, or fan. It determines how many indices to process (starting with the index at StartIndex).

Share this post

Link to post
Share on other sites
Unfortunately yes, the current documentation for DrawIndexedPrimitive is very lacking, bordering on just plain wrong. This has been fixed for the next release, which I realize won''t help you now, but I wanted to mention that we''re doing our best to find and fix small issues like this in the SDK. In the meantime, Tom Forsyth has written a very clear explanation of DrawIndexedPrimitive which you might want to check out:


Hope that helps,

- Jon

Jonathan Steed
Software Design Engineer
Windows Graphics and Gaming Technologies

This posting is provided "AS IS" with no warranties, and confers no rights

Share this post

Link to post
Share on other sites
Thanx alot guys. If set the startIndex to the first triangle i want to render, instead of the first index i want to render.

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.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!