glGetUniformLocation Function

Syntax

GL_APICALL int GL_APIENTRY glGetUniformLocation(
     GLuint program,
     const char * name
);

Arguments

Name Description
in program Program object
in name Name of uniform variable

Return Values

Location of uniform variable

Description

Gets the location of a uniform variable.

The location is used to get and set the uniform variable's values. Set program to the program object. Set name to the name of the uniform variable whose location is to be obtained. If the uniform variable specified by name is found in the program, its location is returned. If it is not found or an error occurs, a value of -1 is returned.

To specify the element to access in a uniform variable array, add an offset to the obtained location. If you add i to the location, it is handled as the location of the (i+1)th element of the uniform variable array.

This function generates the following errors.

GL_INVALID_VALUEThe program argument was set to an invalid value.
GL_INVALID_OPERATIONThe program argument is not linked correctly.

Revision History

2010/01/07
Initial version.

CONFIDENTIAL