• Advertisement
Sign in to follow this  

is it necessary to invoke SetVertexDelaration() before we use effect?

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

Greeting!

I find many samples in DXSDK invoke SetVertexDeclaration() before using effect, and I also find it still works normally if i remove the SetVertexDeclaration.

So i want to know is it necessary to invoke SetVertexDelaration() before we use effect?

Share this post


Link to post
Share on other sites
Advertisement
If you have manually created a primitive then you must use SetVertexDeclaration. But how ever you don't have to do that when rendering geometry data from x files. Am sure those samples are x files, aren't they?

Share this post


Link to post
Share on other sites
Yes, the mesh is loaded from x file. Why doesn't the mesh loaded from x file need to SetVertexDeclaration?

Does the ID3DXMesh interface contain the vertex declaration stored in x file and set it in DrawSubset()?

Share this post


Link to post
Share on other sites
There's an exact vertex declaration equivalent for every FVF. And every mesh has a FVF property. So, you don't need to manually call IDirect3DDevice9::SetVertexDeclaration(), because ID3DXMesh::DrawSubset() function calls IDirect3DDevice9::SetVertexDeclaration() before calling SetStreamSource() and SetIndices().

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement