Sign in to follow this  

CloneMeshFVF() problems.

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

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->Release();
			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

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