Sign in to follow this  
Endar

Textures in FFP vs textures in shaders

Recommended Posts

I have a couple of questions regarding settings textures with D3D.
Quote:
DirectX Documentation for C++ - IDirect3DDevice9::SetTexture Textures are bound to samplers; samplers define sampling state such as the filtering mode and the address wrapping mode. Textures are referenced differently by the programmable and the fixed function pipeline:
  • Programmable shaders reference textures using the sampler number. The number of samplers available to a programmable shader is dependent on the shader version. For vertex shaders, see see Sampler. For pixel shaders see Sampler.
  • The fixed function pipeline on the other hand, references textures by texture stage number. The maximum number of samplers is determined from two caps: MaxSimultaneousTextures and MaxTextureBlendStages of the D3DCAPS9 structure.
This is a little confusing to me. I want to use the 'SetTexture' function to set a texture but I'm not sure if I have to set the texture differently if I'm using the fixed function pipeline or programmable shaders. And, well the above doesn't really clear anything up for me.

Share this post


Link to post
Share on other sites
You use SetTexture the same. The only difference is that in the fixed function the first stage uses texture 0, the second stage texture 1, etc., while pixel shaders have a more complex definition, allowing you to use the textures more freely.

(Also note that in the fixed function pipeline the first texture coordinate set applies to the first stage, the second set to the second stage, etc., unless you use D3DTSS_TEXCOORDINDEX to change this.)

Share this post


Link to post
Share on other sites
Quote:
Original post by ET3D
Also note that in the fixed function pipeline the first texture coordinate set applies to the first stage, the second set to the second stage, etc., unless you use D3DTSS_TEXCOORDINDEX to change this.

So, if I had a vertex structure with 2 sets of texture coords, the first would be for the first texture I had set and the second set would be for the second texture I set?

Share this post


Link to post
Share on other sites
Quote:
Original post by Endar
So, if I had a vertex structure with 2 sets of texture coords, the first would be for the first texture I had set and the second set would be for the second texture I set?

That is correct.

Share this post


Link to post
Share on other sites

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