Hi all.

I recently discovered a bug in my engine. It's about the DrawIndexedPrimitive routine.
Earlier versions of my engine worked fine, but after some major changes, something went wrong. :cry:

Fortunatly i was able to reproduce the bug. I used one of clooties D3D samples.
You can download the source here

{It took some time to find free webspace..i hope the download works }

I created a triangle (3 Vertices) and an IndexBuffer with 3 Indices. And then i wanted to render it using the following call:

[pascal]
g_pd3dDevice.DrawIndexedPrimitive(D3DPT_TRIANGLELI ST, 0,3 ,0, 1);
[/pascal]

Wich is a good call in this case, if i'am not mistaking. :?
Unfortunatly Nothing was rendered. :cry:

But i also tried this:

[pascal]
g_pd3dDevice.DrawIndexedPrimitive(D3DPT_TRIANGLELI ST, 0,2 ,0, 1);
[/pascal]

Wich resulted in this:


And when i Increased the primitivecount.... like this:

[pascal]
g_pd3dDevice.DrawIndexedPrimitive(D3DPT_TRIANGLELI ST, 0,3 ,0, 2);
[/pascal]

The Triangle was rendered correctly like shown below:


Can someone explain me, why the first call didn't work and the third did work??

Thanx for your help