Replacing FVF calls with Vertex Declarations in DX9

Started by
3 comments, last by PrincessDaisy 18 years, 1 month ago
Is it possible to use D3D's vertex declarations and D3DVERTEXELEMENT9 structures in-place of FVF declarations in the fixed function pipeline? My engine is currently 100% FF, and I am in the process of playing around with Cg, and I would like it to be possible for the end-user to use shaders when they want, and the FF pipeline anyother time. The SDK doc's are quite vague on the usage of D3DVERTEXELEMENT9 structures, and their relationship to custom FVF declarations. Ideally, I would like to use one or the other, rather than having to check if the user is declaring vertex shaders or not and using something else. Thanks Daisy
________________________
Pretty In Pink
Advertisement
Yes it is possible. I do it in this tutorial here. Check it out. Hope it helps
Did you write these tutorials? If so, they are very nicely done :)

A couple of questions though. The tutorial you pointed to did indeed use the vertex declarations using D3DVERTEXELEMENT9, but used DrawPrimitiveUP. But in a later tutorial which specifically uses index and vertex buffers, FVF formats are used instead.

Is there a specific reason for this?

Also, I read somewhere that as it is for use with shaders, only shader compatable crads can actually use them. My laptop machine doesn't actually have any shader support, so can I still them?

Thanks for your quick reply
Daisy
________________________
Pretty In Pink
Quote:Original post by PrincessDaisy
A couple of questions though. The tutorial you pointed to did indeed use the vertex declarations using D3DVERTEXELEMENT9, but used DrawPrimitiveUP. But in a later tutorial which specifically uses index and vertex buffers, FVF formats are used instead.

Is there a specific reason for this?

I didn't write the tutorials, so I can't say for sure, but using FVF codes is normally easier than declarations. If you don't need to do anything special, it's simply less work than using declarations.

Quote:Original post by PrincessDaisy
Also, I read somewhere that as it is for use with shaders, only shader compatable crads can actually use them. My laptop machine doesn't actually have any shader support, so can I still them?

As of DX9, FVF and declarations are both valid as a part of the API. DX can translate between the two as needed for it's own internal considerations, but this is irrelevant. Both are supported on any card and driver, however, certain limitations do apply.

You can find more information about these limitations on this page (scroll about half way down).

Hope this helps :).
Sirob Yes.» - status: Work-O-Rama.
Excellent, thanks for the clarification.

I'll get cracking on converting my code to the vertex declarations, then I can start on Cg :)

Thanks again
Daisy
________________________
Pretty In Pink

This topic is closed to new replies.

Advertisement