kurlyak at December 29th, 2011 07:00 — #1
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 );
Thanks in advance.
rouncer at December 29th, 2011 10:15 — #2
you havent set the primitive topology, for one thing, try that...
dc->IASetPrimitiveTopology( D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST );
kurlyak at December 29th, 2011 11:36 — #3
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.
reedbeta at December 29th, 2011 13:46 — #4
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.
kurlyak at December 29th, 2011 14:31 — #5
You are god of this forum! Great thanks, Reedbeta!
rouncer at December 29th, 2011 16:19 — #6
he is indeed.