Advertisement Jump to content
Sign in to follow this  

Vertex Buffer Issue

This topic is 4917 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 have a vertex buffer filled, index buffer filled, and when I render the model, it shows up fine... I'm manual parsing this file by the way. edit: Since there are two materials, I split the indicies into two groups, there are 600 faces. when I render like this: m_RenderingDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,0,m_VertexCount,0,600); //everything shows up fine. When I render like this with 2 calls: m_RenderingDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,0,m_VertexCount,0,300); m_RenderingDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,0,m_VertexCount,301,600); I see some of the model and a bunch of missing triangles. Any idea why? By the way, those calls are in loops, I'm resetting the vertex buffer and index buffer etc. But this should render the whole model, I'm just seperating the faces into parts right?? Why is this not working? Thanks a lot Jeff [Edited by - webjeff on August 7, 2005 2:25:35 PM]

Share this post

Link to post
Share on other sites
Hi there webjeff,
How are you doing?

[The problem]
When you split up your render calls you are missing some triangles.
[source lang = c++]
//everything shows up fine.

//This is broken

[The solution]
Let's look at the call you are invoking.
HRESULT DrawIndexedPrimitive(
INT BaseVertexIndex,
UINT MinIndex,
UINT NumVertices,
UINT StartIndex,
UINT PrimitiveCount

1) You are saying there are "there are 600 indicies.".
This does not mean it has 600 primitives.

a quad has 4 indices but only 2 primitives.

2) Also the 2nd last parameter is the start index. You are specifying that the index is 301, which might be wrong..

3) The last parameter takes the number of primitives to be drawn, not the number of indices :)

You might want to take a look at this article.

I hope this helps a bit.
Keep cool

Share this post

Link to post
Share on other sites
No you are absolutely correct.

I was typing too fast :). There are 600 faces, not indicies. so I am rendering have the faces. each face contains 3 indicies. Sorry for the confusion.

I will edit the post to make clearer. But I am doing 600 FACES not indicies. Thanks for the mixup. Any other ideas on why that might be wrong?


Share this post

Link to post
Share on other sites
I found the problem... Just incase you run into the same thing, read the docs closer.

These lines are wrong:

should be:

Notice the *3, its the index start, not the primative start, I was thinking the last two parameters were the same. also, the last param should be the count, not the total.

Those 2 things fixed it.

Share this post

Link to post
Share on other sites
But I am doing 600 FACES not indicies.

Exactly. You are drawing 300 faces, not indices, meaning 300 faces * 3 indices per face = 900 indices.

Also, in you DIP call, the last parameter is not an "end index" value. It's the number of primitives to draw. So, your calls should be..


First batch starts at index 0 and draws 300 faces. Each face is 3 indices, so indices 0-899 are used. Then, the second batch begins at index 900 (first undrawn index) and draws the other 300 faces.

Dammit, you figured it out ;)

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using, you agree to our community Guidelines, Terms of Use, and Privacy Policy. 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!