Can someone tell me about the seemingly uselessly complex Uniform Buffers? I read the section in OpenGL Superbible 5, I looked at some examples on blogs, and I read the official specification, and I still don't understand.
In particular, for all the examples, apparently, you need to start with a shader program in order to first create a single buffer using glGetActiveUniformsiv. I do not understand this. Why the interface does not allow you to determine the structure without accessing the shader program, checking the / s buffer formats for the program during the connection?
Secondly, if I get the structure structure from one program, assuming that the structure structure is the same for all programs using a set of uniforms, is the structure guaranteed by the same offsets, data sizes, etc.? I would suggest so.
Thirdly, I do not understand the bindings. I need to call glBindBufferBase with an index, and then call glUniformBlockBinding with the block index and index that I passed to glBindBufferBase. I find it difficult to understand what is happening here. Superbible is not clear, as are the specs and samples I've seen.
source share