Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Cow-Man

D3DXCreateMesh

This topic is 6254 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Good Day Everyone, As the subject says, I''ve got a slight problem with this function. I can create the mesh, and save this mesh to "mesh.x", but however when i try to load the mesh it can''t read the file. This is my code for loading and saving the mesh: HRESULT MeshCreator::CreateMesh( LPDIRECT3DDEVICE8 Dev, LPDIRECT3DVERTEXBUFFER8 Vb ) { HRESULT hr; if( Dev ) { Vb->Lock( 0, 0, (BYTE**)&MeshVertices, NULL ); MeshVertices[NumVertices].Create( 0.0f, 0.0f, 0.0f, D3DCOLOR_ARGB( 0, 0, 0, 255 ) ); MeshVertices[NumVertices++].Create( 0.0f, 0.0f, 1.0f, D3DCOLOR_ARGB( 0, 0, 0, 255 ) ); MeshVertices[NumVertices++].Create( 1.0f, 0.0f, 0.0f, D3DCOLOR_ARGB( 0, 0, 0, 255 ) ); Vb->Unlock( ); NumFaces = 1; hr = D3DXCreateMeshFVF( 1, 3, D3DXMESH_VB_MANAGED, D3DFVF_Mesh, Dev, &pMesh ); if( hr != D3D_OK ) { Log( "Could not Create Mesh\n" ); if( hr == D3DERR_INVALIDCALL ) Log( "Invalid Call\n" ); return FALSE; } pMesh->GenerateAdjacency( 0.0, &pAdjacency ); hr = FVFCloneMesh( Dev, D3DFVF_Mesh ); if( hr != TRUE ) Log( "Could not Clone Mesh\n" ); return TRUE; } else { Log( "Device Failed\n" ); return FALSE; } } HRESULT MeshCreator::SaveMeshToFile( LPSTR Filename, LPDIRECT3DDEVICE8 Dev ) { if( Dev ) { D3DXSaveMeshToX( Filename, pMesh, &pAdjacency, pMaterials, NumMaterials, DXFILEFORMAT_BINARY | DXFILEFORMAT_COMPRESSED ); return TRUE; } else { Log( "Device failed\n" ); return FALSE; } } As before i''ve been able to create the mesh object, but I currently can''t open up the file, the D3DXLoadMeshFromFile function returns. Thanks for the help in advance. -Brad Hittle

Share this post


Link to post
Share on other sites
Advertisement

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!