   How to render the Mesh material&texture by using Vertices?
  a mesh,which has some materials and textures,has been convert to the Vertices form(VB&IB).NOW how can I render it with material&texture?The D3DXMESH call DrawSubset method by specific AttribId.It will render the each part of mesh with the different material&texture.But I don''t know how to render the each part of mesh by VB&IB.Need help. 
  When you load your mesh, you also retrieve an array of the materials and textures used by the mesh.  In the following code, I assume that "pMaterials" is an array of the materials used by the mesh, "pTextures" is an array of textures used by the mesh (if there is no texture corresponding to a particular material, then that index in the array of textures is set to NULL).Also, you need to call ID3DXMesh::GetAttributeTable to get a description of which materials are used with which triangles of the mesh.  To be able to call GetAttributeTable successfully, you must first call ID3DXMesh::Optimize or ID3DXMesh::OptimizeInPlace to actually generate the attribute table. // During init, you load the mesh, and initialize the arrays of // materials and textures.// Then you generate your attribute table.DWORD* pAdjacency = NULL;pAdjacency = new DWORD[3*pMesh->GetNumFaces()];pMesh->GenerateAdjacency( 0.0f, pAdjacency )pMesh->OptimizeInPlace( D3DXMESHOPT_COMPACT | D3DXMESHOPT_ATTRSORT | D3DXMESHOPT_VERTEXCACHE, pAdjacency, NULL, NULL, NULL );DWORD dwAttribTableSize;pMesh->GetAttributeTable(NULL, &dwAttribTableSize);D3DXATTRIBUTERANGE* pAttribTable = new D3DXATTRIBUTERANGE[dwAttribTableSize];pMesh->GetAttributeTable(pAttribTable, &dwAttribTableSize)// You can keep the adjacency info if you like for other things.SAFE_DELETE_ARRAY(pAdjacency)// To render you do this....m_pd3dDevice->SetIndices( pIndexBuffer );m_pd3dDevice->SetStreamSource( 0, pVertexBuffer, 0, pMesh->GetNumBytesPerVertex() );for( int i = 0; i < numMaterials; i++ ){  m_pd3dDevice->SetMaterial( pMaterials[i] );  m_pd3dDevice->SetTexture(0, pTextures[i] );  m_pd3dDevice->DrawIndexedPrimitive(D3DPT_TRIANGLELIST, 0, pAttribRange[i].VertexStart, pAttribRange[i].VertexCount, pAttribRange[i].FaceStart*3, pAttribRange[i].FaceCount );}Hope this helps,neneboricua   [edited by - neneboricua19 on February 13, 2004 2:19:21 PM];  Thanks for your help!The problem has been solved! 