   Invalid call with  D3DXCreateMesh
  Before now, I've been using vertex buffers and index buffers separately to store information for polygons, but now I want to use meshes to get the additional functionality out of them. I can't get past the mesh creation process. The function returns an invalid call, and the mesh object doesn't get set up. Here's the info I'm trying to use.// Vertex Declaration for hardware instancingstatic D3DVERTEXELEMENT9 meshVertexN[] ={    { 0, 0,D3DDECLTYPE_FLOAT3,0,  D3DDECLUSAGE_POSITION,  0 },{ 0, 12,    D3DDECLTYPE_FLOAT3,0,  D3DDECLUSAGE_NORMAL,    0 },    { 0, 24,    D3DDECLTYPE_FLOAT2,0,  D3DDECLUSAGE_TEXCOORD,  0 },    { 1, 0,D3DDECLTYPE_D3DCOLOR,   0,  D3DDECLUSAGE_COLOR,0 },    { 1, 4,D3DDECLTYPE_FLOAT4,0,  D3DDECLUSAGE_TEXCOORD,  1 }, // location/scale    D3DDECL_END()};ID3DXMesh* pMesh = 0;D3DXCreateMesh(numVertices / 3, numVertices, D3DXMESH_MANAGED, meshVertexN, pDevice, &pMesh);It might be my vertex declaration that isn't getting accepted. But it has always worked fine using just vertex and index buffers.   
  I think you are running into a problem with this (from the docs):"pDeclaration : This parameter must map directly to a flexible vertex format (FVF)."I haven't used a FVF in a long while. IIRC, a FVF can only have one stream and the vertex data has to be arranged in a specific order. You should look into turning on the D3D Debug runtimes and see what the output window complains about. I'm fairly certain about the one stream though, since an ID3DXMesh only handles one vertex buffer.   ;The debug runtimes are your friend.