How do I conver to .X file

Started by
2 comments, last by Steve_Segreto 14 years, 8 months ago
I am reading "Beginning Direct X 9" and the book gave me this function D3DXSaveMeshToX("cube.x", cubeMesh, NULL, &material, NULL, 1, DXFILEFORMAT_TEXT); It doesnt work... Can anyone guide me through how to convert to .x file? And also... what's strcat()? thanks in advance
Advertisement
Quote:It doesnt work..
That doesn't provide any information for anyone to work with, Templar8guy. Check the forum FAQ which provides some guidance on making a successful post. The FAQ also recommends that you at least make an attempt to answer your own questions before you post. I googled for "strcat" and got over 500,000 hits.

Having said that, what error code are you getting from the D3DXSaveMeshToX call? When you're just starting out in DirectX, it's a really good idea to check the return codes for every call you make. The return code is the "HRESULT hr" value that's returned from the call.

Also, the SDK has several examples of D3DXSaveMeshToX. You might try working with those and see if you're using the correct types of parameters.

Please don't PM me with questions. Post them in the forums for everyone's benefit, and I can embarrass myself publicly.

You don't forget how to play when you grow old; you grow old when you forget how to play.

Quote:Original post by Buckeye
Quote:It doesnt work..
That doesn't provide any information for anyone to work with, Templar8guy. Check the forum FAQ which provides some guidance on making a successful post. The FAQ also recommends that you at least make an attempt to answer your own questions before you post. I googled for "strcat" and got over 500,000 hits.

Having said that, what error code are you getting from the D3DXSaveMeshToX call? When you're just starting out in DirectX, it's a really good idea to check the return codes for every call you make. The return code is the "HRESULT hr" value that's returned from the call.

Also, the SDK has several examples of D3DXSaveMeshToX. You might try working with those and see if you're using the correct types of parameters.


D3DXCreateMeshFVF( DWORD numfaces, DWORD NumVertices, DWORD Option, DWORD FVF. LPDIRECT3DDEVICE9 pDevice, LPD3DXMESH *ppMesh);

D3DXCreateMeshFVF();
requires to know a number of faces and number of vertices in order to use

D3DXSaveMeshToX();

So... how do I find out the number of faces and number of vertices?

"Beginning Game Programming" by Jonathan S. Harbour suggest to use conv3ds. And it's not working because when I click on the program, it said reinstalling it would help and I did and still doesn't work. It gives me the reinstalling message again.

P.S. I did tried to search over google, I just don't understand what they are talking about. That's why I ask here, hopefully someone can explain to me in details.

P.S. I messed around with the mesh in the SDK before.
If you've already got the mesh loaded into a ID3DXMESH pointer, you can get the number of faces and vertices like this:

DWORD m_dwNumFaces = cubeMesh->GetNumFaces();
DWORD m_dwNumVertices = cubeMesh->GetNumVertices();

where "cubeMesh" is the pointer to your ID3DXMESH object.

I'm just as confused as BuckEye, why are you trying to use the D3DXCreateMeshFVF() function? That is how you would basically create an empty mesh with room enough for a certain number of faces and vertices, but it would be up to you to lock the vertex/index buffer and fill in that data to form some type of geometry.

If you've already got the mesh, just save it off with the call to D3DXSaveMeshToX().

This topic is closed to new replies.

Advertisement