   Trouble with vertex declarations
  My vertex format consists of xyz (3 floats), normal (3 floats), uv (2 floats), tangent (3 floats), bitangent (3 floats).  Does anyone see anything wrong with my set-up below?Quote:GetDevice()->CreateVertexBuffer(m_nVertices * sizeof(kbD3D_VF),D3DUSAGE_WRITEONLY,D3DFVF_XYZ | D3DFVF_NORMAL | D3DFVF_TEXCOORDSIZE2(0) |D3DFVF_TEXCOORDSIZE3(1) | D3DFVF_TEXCOORDSIZE3(2),D3DPOOL_MANAGED,&m_pD3DVertBuffer,NULL);   D3DVERTEXELEMENT9 g_aVertDecl[] ={    { 0, 0,  D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },    { 0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL,   0 },    { 0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },{ 0, 32, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 1 },{ 0, 44, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 2 },    D3DDECL_END()};Thanks   
  You might want to consider using something like this,D3DVERTEXELEMENT9 elements[] ={{ 0, sizeof( float ) * 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0 },{ 0, sizeof( float ) * 3, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0 },{ 0, sizeof( float ) * 6, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0 },{ 0, sizeof( float ) * 8, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0 },{ 0, sizeof( float ) * 11, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BINORMAL, 0 },D3DDECL_END()};You will notice that DirectX gives you the components you are looking for such as Binormals and Tangents as a Declaration usage flags. You could just match your Vertex Format to suite.I hope this helps.   ;  Thanks for the response, so I guess my createvertexdecl and createvertex buffer match up then?I'm getting this error in debug, but everything is fine in releaseQuote:Direct3D9: (ERROR) :Invalid index in the index stream: 322I'm pretty sure I've filled the vertex buffer correctly.I know that this is vague, but any ideas of things I should look at?   ;  Nevermind, got it.Turns out my NumVertices parameter in DrawIndexedPrimitive command was off by one.