Sign in to follow this  

How do I conver to .X file

This topic is 3043 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

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

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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().

Share this post


Link to post
Share on other sites

This topic is 3043 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this