DrawIndexedPrimitive

Started by
4 comments, last by Randy187 20 years, 6 months ago
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?
Advertisement
Please use the search feature. I''ve personally answered this question atleast 3 or 4 times this year.
Search feature very rarely works. at least for me. What error are you getting? What parameters specifically are you unsure about?

ATS
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).
John BoltonLocomotive Games (THQ)Current Project: Destroy All Humans (Wii). IN STORES NOW!
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:

http://tomsdxfaq.blogspot.com/2002_05_01_tomsdxfaq_archive.html

Hope that helps,

- Jon

========================
Jonathan Steed
Software Design Engineer
Windows Graphics and Gaming Technologies
Microsoft

This posting is provided "AS IS" with no warranties, and confers no rights
========================Jonathan SteedSoftware Design EngineerWindows Graphics and Gaming TechnologiesMicrosofthttp://blogs.msdn.com/jsteedThis posting is provided "AS IS" with no warranties, and confers no rights
Thanx alot guys. If set the startIndex to the first triangle i want to render, instead of the first index i want to render.

This topic is closed to new replies.

Advertisement