I have a shader I wrote to do some custom lighting calculations. I apply this shader to my whole scene. To calculate the output color from the fragment shader, it multiplies the lighting calculation by the interpolated vertex color and the texture color like this:
o_color=lighting_factor * l_color * tex2D(tex_0,l_texcoord0);
The problem is that not all models in the scene have a texture map assigned and when you sample an undefined texture, bad things happen. Is there any way in a shader to test if a sampler actually has a texture assigned to it or not? Or is there a way to make panda pass some kind of boolean to the shader that says whether that object has a texture on it?