Sign in to follow this  
BishGada

GLSL lights and textures states

Recommended Posts

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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this