Jump to content
  • Advertisement
Sign in to follow this  
xujiezhige

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

This topic is 2412 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
×

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!