Original Post
Hi im having some trouble loading more than one mesh with directx. ill show you what ive donefor 1 mesh which is working and maybe you can help me with two. to load the mesh ive ued LPD3DXBUFFER pD3DXMtrlBuffer; if( FAILED(D3DXLoadMeshFromX( "house.x",D3DXMESH_SYSTEMMEM,g_pd3dDevice,NULL,&pD3DXMtrlBuffer, NULL, &g_dwNumMaterials, &g_pMesh))) { if( FAILED(D3DXLoadMeshFromX( "..\\Toyota.x",D3DXMESH_SYSTEMMEM, g_pd3dDevice,NULL, &pD3DXMtrlBuffer, NULL, &g_dwNumMaterials, &g_pMesh))) { return E_FAIL; } } D3DXMATERIAL* d3dxMaterials = (D3DXMATERIAL*)pD3DXMtrlBuffer->GetBufferPointer(); g_pMeshMaterials = new D3DMATERIAL9[g_dwNumMaterials]; g_pMeshTextures = new LPDIRECT3DTEXTURE9[g_dwNumMaterials]; for(DWORD i=0; i = d3dxMaterials.MatD3D; g_pMeshMaterials.Ambient = g_pMeshMaterials.Diffuse; g_pMeshMaterials.Diffuse = g_pMeshMaterials.Diffuse; g_pMeshMaterials.Specular = g_pMeshMaterials.Specular; g_pMeshTextures = NULL; if(d3dxMaterials.pTextureFilename != NULL && lstrlen(d3dxMaterials.pTextureFilename)>0) { if(FAILED(D3DXCreateTextureFromFile(g_pd3dDevice, d3dxMaterials.pTextureFilename, &g_pMeshTextures))) { const TCHAR* strPrefix = TEXT("..\\"); const int lenPrefix = lstrlen( strPrefix); TCHAR strTexture[MAX_PATH]; lstrcpyn( strTexture, strPrefix,MAX_PATH); lstrcpyn( strTexture + lenPrefix, d3dxMaterials.pTextureFilename, MAX_PATH - lenPrefix); if(FAILED(D3DXCreateTextureFromFile(g_pd3dDevice, strTexture, &g_pMeshTextures))) { MessageBox(NULL, "Could not find texture map", "Meshes.exe", MB_OK); } } } } // pD3DXMtrlBuffer->Release(); and to render my object im using for( DWORD i=0; iSetMaterial(&g_pMeshMaterials); g_pd3dDevice->SetTexture(0,g_pMeshTextures); //draw mesh subset g_pMesh->DrawSubset(i); } looking at the way ive loaded one meh is anyone able to give some advice on loading two, ive tried a few things but nto working. thanks in advance