Browse Source

gpu: fix the computed element count in DrawIndexedElements on Direct3D.

legacy
Sam Hocevar sam 12 years ago
parent
commit
fa646c41c3
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      src/gpu/vertexbuffer.cpp

+ 5
- 1
src/gpu/vertexbuffer.cpp View File

@@ -199,20 +199,24 @@ void VertexDeclaration::DrawIndexedElements(MeshPrimitive type, int vbase,
g_d3ddevice->SetRenderState(D3DRS_ALPHABLENDENABLE, 1);
g_d3ddevice->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
g_d3ddevice->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW);
if (FAILED(g_d3ddevice->SetRenderState(D3DRS_CULLMODE, D3DCULL_CW)))
Abort();
switch (type)
{
case MeshPrimitive::Triangles:
count = count / 3;
if (FAILED(g_d3ddevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST,
vbase, vskip, vcount, skip, count)))
Abort();
break;
case MeshPrimitive::TriangleStrips:
count = count - 2;
if (FAILED(g_d3ddevice->DrawIndexedPrimitive(D3DPT_TRIANGLESTRIP,
vbase, vskip, vcount, skip, count)))
Abort();
break;
case MeshPrimitive::TriangleFans:
count = count - 2;
if (FAILED(g_d3ddevice->DrawIndexedPrimitive(D3DPT_TRIANGLEFAN,
vbase, vskip, vcount, skip, count)))
Abort();


Loading…
Cancel
Save