I've been stuck on this error for a while and unable to solve it. The problem only occurs when running on the debug version of direct 3d9. My mesh will not render, and I get this error in the debug console.
I am setting the vertex declaration explicitly before rendering, so Im not sure whats wrong. I get the same problem in a couple different places...
On my custom mesh format that just uses buffers:
void Mesh::Render()
{
dxDevice->SetVertexDeclaration(pVertexDecl);
dxDevice->SetIndices(pIndexBuffer);
dxDevice->SetStreamSource( 0, pVertexBuffer, 0, sizeof(VFORMAT) );
dxDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, 0, (UINT)faces.size()*3, 0, (UINT)faces.size());
}
Also, when rendering the .X files I loaded with D3DXLoadMeshFromX:
for( DWORD i=0; i<dwNumMaterials; i++ )
{
dxDevice->SetMaterial( &pMeshMaterials );
dxDevice->SetTexture( 0, pMeshTextures );
pMesh->DrawSubset( i ); //Direct3D9: (ERROR) :Vertex stride in stream 0 is less than in the declaration
}
This problem occurs before any issues with device being lost. Any idea where to look?