September 2018
Intermediate to advanced
472 pages
15h 36m
English
After linking and enabling the shader program, use the following code to display the list of active uniforms:
GLint numUniforms = 0; glGetProgramInterfaceiv( handle, GL_UNIFORM, GL_ACTIVE_RESOURCES, &numUniforms);
GLenum properties[] = {GL_NAME_LENGTH, GL_TYPE, GL_LOCATION, GL_BLOCK_INDEX};
std::cout << "Active uniforms" << std::endl;
for( int i = 0; i < numUniforms; ++i ) {
GLint results[4];
glGetProgramResourceiv(handle, GL_UNIFORM, i, 4, properties, 4, NULL, results); if( results[3] != -1 ) continue; // Skip uniforms in blocks GLint nameBufSize ...Read now
Unlock full access