Jump to content
  • Advertisement
Sign in to follow this  
BishGada

GLSL lights and textures states

This topic is 4153 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
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.

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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!