I hacked at this most the this morning and I’m no closer to a resolution. I’ve tried it on three different computers. My old laptop running Win 7 and almost GL 3.1, another laptop with Win 8 and GL 4.1 and a desktop with Win 10 and GL4.5. Each is a little different. The second laptop just renders everything black after adding the second light no matter if I use hard coded values, constants, or anything else.
The other two computers seem to render fine when using hard coded values and other hacks. However, when trying to loop through the lights, everything rendered by this shader is black. It’s still there, it’s just black. Everything rendered in the scene with other shaders looks fine.
Also, I should add that the shader compiles without even a warning on all three computers I tried.
I’ve tried all different shader versions, but started with 330 and went up from there. Also, my drivers are as up to date as they’re going to get. I don’t expect anything new for my old laptop.
What I really don’t understand is that I’m doing the exact same thing with a regular old uniform and it works:
I don’t understand why this works and the other doesn’t.
I would like to use a ubo to ease access to the data with multiple shaders. If anyone has any ideas why this loop works and the ubo loop doesn’t I’d be glad to hear it; I’m stumped.