View Full Version : SetTexture() / sampler2D binding problem

10 October 2003, 01:01 PM
Hi all.

How is a texture stage bound to the uniform inputs of a pixel shader? As far as I get it the order of the uniform decls in the pshader represent the texture stages...

I use DX8 and Cg, however not the Cg toolkit.

If so, how can the following pshader (that takes the color output ONLY from tex stage 1) change output when a new texture is loaded into stage 0? That's the prob I have here atm...

struct v2f_simple {
float4 HPosition : POSITION;
float2 TexCoord0 : TEXCOORD0;
float2 TexCoord1 : TEXCOORD1;
float4 Color0 : COLOR0;

fragout main(v2f_simple IN,
uniform sampler2D ShadowMap,
uniform sampler2D SpotLight)
fragout OUT;

float4 temp = tex2D(ShadowMap);
OUT.col = tex2D(SpotLight);

return OUT;


CGTalk Moderation
01 January 2006, 11:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.