glGetProgramResourceLocation

glGetProgramResourceLocation: man4/glGetProgramResourceLocation.xml

glGetProgramResourceLocation returns the location assigned to the variable named name in interface programInterface of program object program. program must be the name of a program that has been linked successfully. programInterface must be one of GL_UNIFORM, GL_PROGRAM_INPUT, GL_PROGRAM_OUTPUT, GL_VERTEX_SUBROUTINE_UNIFORM, GL_TESS_CONTROL_SUBROUTINE_UNIFORM, GL_TESS_EVALUATION_SUBROUTINE_UNIFORM, GL_GEOMETRY_SUBROUTINE_UNIFORM, GL_FRAGMENT_SUBROUTINE_UNIFORM, GL_COMPUTE_SUBROUTINE_UNIFORM, or GL_TRANSFORM_FEEDBACK_BUFFER. The value -1 will be returned if an error occurs, if name does not identify an active variable on programInterface, or if name identifies an active variable that does not have a valid location assigned, as described above. The locations returned by these commands are the same locations returned when querying the GL_LOCATION and GL_LOCATION_INDEX resource properties. A string provided to glGetProgramResourceLocation is considered to match an active variable if:

  1. the string exactly matches the name of the active variable
  2. if the string identifies the base name of an active array, where the string would exactly match the name of the variable if the suffix "[0]" were appended to the string
  3. if the string identifies an active element of the array, where the string ends with the concatenation of the "[" character, an integer identifying an array element, and the "]" character, the integer is less than the number of active elements of the array variable, and where the string would exactly match the enumerated name of the array if the decimal integer were replaced with zero.

Any other string is considered not to identify an active variable. If the string specifies an element of an array variable, glGetProgramResourceLocation returns the location assigned to that element. If it specifies the base name of an array, it identifies the resources associated with the first element of the array.

@OpenGL_Version(OGLIntroducedIn.V4P3)
@OpenGL_Extension("GL_ARB_program_interface_query")
fn_glGetProgramResourceLocation glGetProgramResourceLocation;

See Also

glGetProgramResourceName, glGetProgramResourceIndex, glGetProgramResource, glGetProgramResourceLocationIndex.

Meta