Hi,
Is there a way to iterate through the uniforms in the default uniform block, ie: the ‘global’ uniforms, ignoring all uniforms inside uniform blocks?
I’m currently doing something like this:
int numUniforms = 0;
glGetProgramiv(program, GL_ACTIVE_UNIFORMS, &numUniforms);
for (int i = 0; i < numUniforms; ++i) {
int blk = 0;
glGetActiveUniformsiv(program, 1, (GLuint*)&i, GL_UNIFORM_BLOCK_INDEX, &blk);
if (blk != -1) continue;
// If we get here, it's a default/global uniform...
This works, but I have a pretty big array in my uniform block and it takes ages to go through the 128K uniforms in there just to find the 3 ‘global’ ones. Well, not ages, but it just seems like a dumb way to do it.
I also tried glGetActiveUniformBlockiv to get the number and indices of uniforms attached to uniform block ‘-1’ (which,as above, is sometimes the id of the default block - pretty weird behaviour for a GLuint though!) but that doesn’t work either, I just get 0 returned for number of uniforms.
What am I missing here?