Assigning Sampler*s

Hey all,

Is there a way of assigning Texture Units to samplers from inside the shader?
Like

‘uniform sampler2D Texunit0 = 0;’ (Tried and failed, mostly cos its ‘sampler2D=int’ but it demonstrates my point)

Thanks for any help or hints.

Twixn

Not with the current GLSL spec unfortunately.

Samplers are read only variables, because they only can be declared as uniforms, but I can’t see the need of fixing the texture from in the shader… By this way you are making your host application dependent on your shaders, and should be done in the other side… (that’s my though)

Well thanks anyway…The reason i ask is that i use a lot of Textures at a time, and they are always bound to the same tex units so using and assigning individual samplers is messy and a waste of time for me.

Well thanks anyway, that was one of the features i liked in Cg.

Twixn

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.