Archived

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

steg

Index buffer not working ?

Recommended Posts

Hi all, Trying to draw a quad using DrawIndexedPrimitive, nothing is shown on the screen, I get the following error : ''Index stream does not have required number of indices'' My quad is made from two triangles, I have 6 indices, I guess my quad has 4 vertices ? g_pDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,0,4,0,4); I guess the line above is wrong ? Any help is much appreciated. Kind regards, Steve As I get older, my mind becomes more cluttered.

Share this post


Link to post
Share on other sites
It''s ok, I got it working, should have been :

g_pDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,0,0,4,0,2);

Now, wanting to use a triangle strip as oppossed to a list, how do I go about doing this ? Any help is MUCH appreciated.

Steve

As I get older, my mind becomes more cluttered.

Share this post


Link to post
Share on other sites
Your primitive count is off.
You said you only had 2 triangles yet you are telling DrawIndexedPrimitive that you have 4.
The last parameter should be 2 not 4.


-dizzy
Game Institute Intern

[edited by - yzzid on May 5, 2003 3:51:04 PM]

Share this post


Link to post
Share on other sites
Thanks,

If I now wanted to render two of the quads (4 triangles), do I need to have 12 indices ?

I''m confused ???

Thanks,
Steve

Share this post


Link to post
Share on other sites
Well, I''ve been doing some trial and error and now got two quads, I do indeed need 12 indices, but only 6 vertices ;-)
I now understand why using index buffers for terrains are a lot faster than not using them!

Still, is it possible to use strips instead of lists with index buffers - surely this would be even faster ?

Regards,
Steve

Share this post


Link to post
Share on other sites