Hi, I have 15 years of professional development and I’ve toyed with OpenGL along the way, but I’ve been diving in lately and actually reading the books and I’m actually learning things, but I’m having trouble knowing how to organize my code.
I ultimately would like a world I can move around in with lots of lights and reflections. I’m targeting OpenGL ES 1.1 and 2.0 and the 1.1 branch will be limited to the fixed function pipeline and the 2.0 branch will have access to the full range of shader logic I can muster. Questions…
If I want my lights to reflect off of things in my environment all vertex/fragment shaders must know ahead of time about all of the lights in the scene, right?
Therefore shouldn’t all models/scene objects use the same vertex/frag shader that receives all light sources as uniforms?
I was setting things up so that each model could have its own GLSL program with its own vertex/frag shaders, very much independent from each other. Now I’m thinking that was a mistake because if they’re independent how do they all know about each other’s light and reflection info? Also, if the entire fixed function pipeline from 1.1 can be implemented in GLSL, then shouldn’t that be the baseline shader program that all models use and enable special stuff through bools?
Also, on another topic…array of structures vs structure of arrays for vertex attribute data…all of the books and dev docs seem to indicate that you might want to keep your texture coordinates separate from your vertices and normals. I can’t think of any reason why. If you want a different image, can’t you just swap out the active texture? Would you do that if the second texture image has different coords? Isn’t that something that could be handled by better pipeline management?