I am learning DX9 and am loading a x file with D3DXLoadMeshFromX ,no animations just a x file with 3 meshes. pretty simple. It does load and i can render the meshes using a for-next to render the subsets , textures and materials just fine.. The problem I am having is that the pointer returned for the seventh parameter of the D3DXLoadMeshFromX function of DWORD *pNumMaterials, is wrong... it returns that i have 9 material structures in the buffer when there are only three in the x files ... also the eighth parameter a pointer to the new mesh object contains 9 subsets when there only should be three.

upon stepping thru the for-next rendering loop i find that the

d3dDevice->SetMaterial(&pMaterialList[i]); 0-2 have the correct sequence of materials 3-5 and 6-8 are copies of 0-2

same goes for d3dDevice->SetTexture(0,pTextureList[i]);

but the 0-8 subsets there is no mesh rendered for subsets 0,1,3,5,7,8
but subsets 2,4,6 contain what should be subsets 0,1,2

I have checked the x file and it has only 3 materials and three meshes

I used wings 3d
here is part of the last of the x-file
MeshMaterialList {
3;
6;
0;
0;
0;
0;
0;
0;
;
{cube1_auv}
{cube2_auv}
{cube3_auv}
}

I'm not sure if it is the modeling program exporting wrong or something to do with D3DXLoadMeshFromX function.

any comments will be greatly appreciated.

thanx in advance.