GLSL lights and textures states

Started by
1 comment, last by GreyHound 16 years, 10 months ago
Hi all, I couldn't find anywhere, how do I know if light sources are enabled or disabled, when I'm in a vertex or fragment shader code? similar question is how do I know if texture unit is enabled, and another question about textures is how do I know which texture units are bound to the vertex I currently draw. for examples, suppose I have two models, one uses textures 1 and 2 and the other 3 and 4. I want to have the same shadr for both of them but use different textures, so how do I know which textures are bound to it. thanks, Guy.
Advertisement
AFAIK there is no way of knowing that inside the shader. It also wouldn't be wise to write one shader for all of these cases because the if you would have to use would slow down the shader extremly. You should write a Shader for each case and determine before the shader usage witch case is present. To make this task easier you could write youreself a small script language that generates the shaders for you.
http://3d.benjamin-thaut.de
Ingrater is probably right but if you really need to know inside the shader just use a uniform[7] to pass info wether a light is switched on or off.

This topic is closed to new replies.

Advertisement