About SetTexture and Pixel Shader binding problem
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!!!
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.
You can force a shader texture slot to use a given texture register:
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.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement