I'm thinking about how i would implement a parameter system using OpenGL 3.2+ (core profile) and GLSL. I'm talking about uniform (not including samplers) and not vertex attributes. I'm leaning toward using UBOs and uniform blocks in shaders. Here are a few of points i'm not sure about.
- I'm planning to use only one big UBO which will contain all the parameters for all uniform blocks in all programs, specific parameters being updated using an appropriate call to glBufferSubData. So, all uniform blocks a program uses would be associated to the same uniform binding point, let's say 0, using glUniformBlockBinding and glBindBufferRange. Another interesting thing about using only one UBO is that i can bind this UBO at load time and keep it bound during rendering (no need to bind an UBO every time i need to update a parameter). Is it that correct and is there any problem with this method ?
- Since association happens only at initialization time, the uniform block index returned by glGetUniformBlockIndex doesn't need to be kept into a variable assuming this association doesn't change, correct ?
Edited by Laval B, 04 July 2013 - 10:47 AM.