0
101 Dec 29, 2011 at 12:00

I have some code and it wrong. If it not hard please correct my code. I dont understand where and what a value must set. In my code attribute are ordered by index (from 0 to last).

for(UINT i=0; i<pFrame->pMeshContainer->nNumMat; i++)
{
.......................................
UINT nIndxCount = pFrame->pMeshContainer->atr[i].FaceCount * 3;
UINT nStartIndexLocation = pFrame->pMeshContainer->atr[i].FaceStart * 3;
UINT nBaseVertLocation = pFrame->pMeshContainer->atr[i].VertexStart;
UINT stride = sizeof( MY_VERTEX );
UINT offset = 0;
m_pImmediateContext->IASetVertexBuffers( 0, 1, &(pFrame->pMeshContainer->pVB), &stride, &offset );
m_pImmediateContext->IASetIndexBuffer( pFrame->pMeshContainer->pIB, DXGI_FORMAT_R32_UINT, 0 );

m_pImmediateContext->DrawIndexed(nIndxCount,0, nStartIndexLocation );
}


#### 5 Replies

0
103 Dec 29, 2011 at 15:15

you havent set the primitive topology, for one thing, try that…
dc->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );

0
101 Dec 29, 2011 at 16:36

Thank you for your reply. But I dont show all my code. I included primitive topology earlier. In this case, I ask only about the indices and the vertices and DrawIndexed(). My Primitive Topoligy is Trianglelist.

0
167 Dec 29, 2011 at 18:46

Shouldn’t it be DrawIndexed(nIndxCount, nStartIndexLocation, 0)? The second parameter is the start index location, and the third parameter is a vertex offset. See the docs.

0
101 Dec 29, 2011 at 19:31

You are god of this forum! Great thanks, Reedbeta!

0
103 Dec 29, 2011 at 21:19

he is indeed. :)