I'm trying to fill the indices to draw multiple lines with a single draw call:
DWORD linesCount = 4; // Draw 4 lines with one draw call
TVertex* vrts = new TVertex[linesCount]();
for(DWORD i = 0; i < linesCount; i++)
{
vrts[i+0].pos = v0; vrts[0].otherPos = v1;
vrts[i+1].pos = v1; vrts[1].otherPos = v0;
vrts[i+2].pos = v0; vrts[2].otherPos = v1;
vrts[i+3].pos = v1; vrts[3].otherPos = v0;
g_fThickness = 0.5f;
vrts[i+0].thickness = D3DXVECTOR3( -g_fThickness, 0.f, g_fThickness * 0.5f );
vrts[i+1].thickness = D3DXVECTOR3( g_fThickness, 0.f, g_fThickness * 0.5f );
vrts[i+2].thickness = D3DXVECTOR3( g_fThickness, 0.f, g_fThickness * 0.5f );
vrts[i+3].thickness = D3DXVECTOR3( -g_fThickness, 0.f, g_fThickness * 0.5f );
vrts[i+0].texOffset = D3DXVECTOR4( g_fThickness, g_fThickness, 0.f, 0.f );
vrts[i+1].texOffset = D3DXVECTOR4( g_fThickness, g_fThickness, 0.25f, 0.f );
vrts[i+2].texOffset = D3DXVECTOR4( g_fThickness, g_fThickness, 0.f, 0.25f );
vrts[i+3].texOffset = D3DXVECTOR4( g_fThickness, g_fThickness, 0.25f, 0.25f );
}
device->DrawIndexedPrimitiveUP( D3DPT_TRIANGLELIST, 0, linesCount*4, linesCount*2, indexBuffer, D3DFMT_INDEX32, vrts, sizeof( TVertex ) );
Now, I'm not sure how to fill indexBuffer, what values I should give to the index buffer?