Quick question: if you are writing a custom shader for lighting, it is still useful (faster) to use the build in lights from openGL, or might I just as wel use my own array of lights? I don’t expect that many object will be lit by more than 8 lights OFTEN but I would really prefer that it would just work with 9 or more lights as well. So is there still a good reason to use the built in lights from opengl when you write your own shader??
So you’re just talking about using the built-in gl_* uniforms provided by OpenGL with GLSL <= 1.2 instead of passing in your own uniforms. Right?
If so, you’re going to have to have the shader logic in there either way. And it’s just a convenience to use the built-in uniforms populated by the glLight* and other fixed-function APIs.
As you said, using the built-in uniforms implicitly limits you to what the fixed-function pipeline inputs can define (unless you want a complete mix of built-in and custom uniforms). OTOH, if you pass in your own uniforms, you can do whatever you want (new light types, light cone attenuation functions, fog types, etc.).
Further it limits you to GLSL <= v1.2 as these “go away” in GLSL 1.3 IIRC.
If your comfortable with shaders and are starting from scratch, I’d just pass in your own uniforms. Though if you have some existing code that you’re porting that uses the legacy glLight* APIs, then consider using the built-in uniforms with GLSL 1.2 only initially as a porting stepping stone, with the idea of kicking them to the curb once you get things working.
Thanks a lot, that was the answer was hoping for! I am working from scratch and i do prefer my own type of lights, so i’ll just pass my own lights then.