GLSL uniform sampler question

Hi, I am a new bie to GLSL. Here is my question:
I have set a sampler uniform to a fragment shader using glUniformiv(), but I want to get the texture stage it used and the texture target so that i can set some sampler states for it. I have looked for the specification again and again and found nothing.
May be this question is not very advanced, may be I am very stupid:(

Previously I am using NVIDIA’s Cg language and it has the ability to do this, but how can I do this with GLSL?

The value you set into the GLSL sampler uniform is index of texture unit to which you have to bind the desired texture.

try this:

int my_sampler_uniform_location;
my_sampler_uniform_location = GetVariable(“tex”);
glUniform1iARB(my_sampler_uniform_location, unit);

where “tex” is the sampler in your fragment shader
and “unit” is the texture unit index Komat is talking about.



Thank you Komat and hardtop, I’v misunderstand it. Thank you!