With the advent of glUsePrograms there can be multiple bound at once, does the glUniform call affect all that are currently bound?
You’re not thinking in terms of the full Longs Peak experience.
Under LP, there is no “glUniform” call anymore. Well, not to a program. The equivalent call takes a buffer object that was created for the purpose of holding uniform data. So it might look like:
glUniformfv(bufferObject, "glLightDir", direction, 3);
This is just a guess, but it’s gathered from several pages worth of thread discussion.
The buffer object would be created from a program object. Thus BO would be compatible with the program object, and would contain only names that the program object used. Attempting to set program object uniforms that the program didn’t actually specify would produce an error.
A program can have multiple such buffer objects, with the layouts defined by the program (and probably named in some way?). Further, multiple programs with compatible buffer object layouts (all containing the same uniform definitions) can use the same buffer object. Creating such buffer objects may actually be an external process that does not require any particular program object, but that’s going on old data (from discussions months ago) and may not be consistent with the current Longs Peak version.
So, when you want to render with a program, you bind the program and bind to that program its associated uniform buffer objects. You bind to certain slots in those UBOs samplers and texture images as well.
Now, as for multiple programs for different stages, it works as it expects, except that the buffer objects do not cross-connect. If you want the uniform named “glLTPMatrix” to be available in both the vertex and fragment program, you have to bind separate (or possibly the same, but you need two binds) buffer objects that contain that uniform. That’s the price of having separate program objects.
If you used only one program object, then the stages would share uniform data were reasonable. IE, where the different stages refer to the same uniform name.