Sign in to follow this  

CloneMeshFVF() problems.

Recommended Posts

Okay, I am loading a .X Model with
FAILED( D3DXLoadMeshFromX( szFile, D3DXMESH_SYSTEMMEM, pDevice, NULL, &pMaterialBuffer, NULL, &m_dwNumMaterials, &m_pMesh )

When I check to see if this model has vertex normals, I am doing this:
                // Check to see if we need vertex normals.
		if (!(m_pMesh->GetFVF() & D3DFVF_NORMAL))
			ID3DXMesh *pTempMesh = 0;
			m_pMesh->CloneMeshFVF(D3DXMESH_MANAGED, m_pMesh->GetFVF() | D3DFVF_NORMAL, pDevice, &pTempMesh);

			m_pMesh = pTempMesh;

		// Compute normals
		D3DXComputeNormals( m_pMesh, 0 );

And for some wierd reason, after I added the vertex normal compution, it crashes when it tries to render the model when it executes
m_pMesh->DrawSubset( i );

Any help would be much appreciated. Thanks.

Share this post

Link to post
Share on other sites

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