static const GLchar* LightNames[] = { "LightRotate","LightRotate.rot[0]","LightRotate.rot[1]",
"LightRotate.rot[2]","LightRotate.rot[3]" ,"LightRotate.rot[4]" ,"LightRotate.rot[5]" ,
"LightRotate.rot[6]","LightRotate.rot[7]" };
void GetAccessToUniformBlock(GLuint prog, int n, const GLchar** names,
GLuint* ind, GLint* size, GLint* ofs,
GLuint* bpoint){
GLuint ufi[32];
*ind = glGetUniformBlockIndex(prog, names[0]);
glGetActiveUniformBlockiv(prog, *ind, GL_UNIFORM_BLOCK_DATA_SIZE, size);
if (n > 0) {
glGetUniformIndices(prog, n, &names[1], ufi);
glGetActiveUniformsiv(prog, n, ufi, GL_UNIFORM_OFFSET, ofs);
}
*bpoint = NewUniformBindingPoint();
glUniformBlockBinding(prog, *ind, *bpoint);
ExitIfGLError("GetAccessToUniformBlock");
}
Program podczas działania wykrywa błąd i uruchamia procedure ExitIfGLError. Po za komentowaniu procedury glGetActiveUniformsiv program nie wywołuje ExitIfGLError
fragment shader:
uniform LightRotate{
mat4 rot[8];
} lightMat;