Sign in to follow this  
Game_XinBing

About SetTexture and Pixel Shader binding problem

Recommended Posts

I want to know how the SetTexture's texture outside pixel shader binding to texture in pixel shader...... ......I want to set some texture SetTexture(0, pTexBase); SetTexture(1, pTexLightmap); ...... SetTexture(n, pTexn); but...how these textures binding with texture in Pixel Shader (Pixel Shader) texture texBase texture texLightmap ...... texture texTexn how pTexBase & texBase binding(one to one relationship) how pTexLightmap & texLightmap binding(one to one relationship) ...... how pTexn & texTexn binding(one to one relationship) (I use DX9 and hlsl) Thanks You!!!

Share this post


Link to post
Share on other sites
I'm not really sure what you're asking, but I think you might want to search for more information about samplers (sampler2D) or UV coordinates (texcoord0)... but I think you're looking for samplers.

Share this post


Link to post
Share on other sites
You can force a shader texture slot to use a given texture register:


texture diffuseMap : register(t0);
texture lightMap : register(t1);





Then, diffuseMap and lightMap can be set via SetTexture(0) and SetTexture(1) respectively.

If you don't want to force the registers like in the above example, you can use the ID3DXConstantTable interface to find the texture slots given their names, after you've compiled the shader.

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