Jump to content
  • Advertisement

Archived

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

ETPlayer

Problems with cloning meshes

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

Hi I''m trying to clone a mesh to include tangent and binormal information but after the operation the mesh doesn''t render and the debug output reads: D3DX: ID3DXMesh::DrawSubset: The mesh declaration is not compatible with the device. Probably due to unsupported type like UBYTE4 for Float16 This is my code: /*new vertex declaration*/ D3DVERTEXELEMENT9 pDeclaration[]={ {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0}, {0, 12, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0}, {0, 24, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TEXCOORD, 0}, {0, 30, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_TANGENT, 0}, {0, 42, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_BINORMAL, 0}, D3DDECL_END()}; /*meshTMP is a perfectly good mesh loaded from an X file, it renders fine if I don''t clone it or clone it without the new fields in the vertex declaration*/ meshTMP->CloneMesh(D3DXMESH_SYSTEMMEM, pDeclaration, device, &mesh); /*I then use this function to compute the tangent and binormal but I get the bug even if I comment it out so I don''t think there is a problem here*/ D3DXComputeTangent(mesh, 0, 0, 0, TRUE, (DWORD*)adjacency->GetBufferPointer()) Any idea what I am doing wrong? Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
Heh, I got it to work 2 minutes after posting the first message. It seems that D3DDECLTYPE_FLOAT2 requires an offset of 8, not 6.

Share this post


Link to post
Share on other sites

  • 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!