PDA

View Full Version : Assigning Sampler*s



Twixn
11-26-2004, 12:06 AM
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

jra101
11-26-2004, 02:14 PM
Not with the current GLSL spec unfortunately.

Ffelagund
11-26-2004, 02:22 PM
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)

Twixn
11-26-2004, 04:40 PM
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