GLUNIFORM(3gl)GLUNIFORM(3gl)NAME
glUniform1fARB, glUniform2fARB, glUniform3fARB, glUniform4fARB, glUni‐
form1iARB, glUniform2iARB, glUniform3iARB, glUniform4iARB, glUni‐
form3dARB, glUniform1fvARB, glUniform2fvARB, glUniform3fvARB, glUni‐
form1ivARB, glUniform2ivARB, glUniform3ivARB, glUniform4ivARB, glUni‐
formARB, glUniformMatrix2fvARB, glUniformMatrix3fvARB, glUniformMa‐
trix4fvARB - set the value for a uniform variable
C SPECIFICATION
void glUniform1fARB( GLint location,
GLfloat v0 )
void glUniform2fARB( GLint location,
GLfloat v0,
GLfloat v1 )
void glUniform3fARB( GLint location,
GLfloat v0,
GLfloat v1,
GLfloat v2 )
void glUniform4fARB( GLint location,
GLfloat v0,
GLfloat v1,
GLfloat v3,
GLfloat v4 )
void glUniform1iARB( GLint location,
GLint v0 )
void glUniform2iARB( GLint location,
GLint v0,
GLint v1 )
void glUniform3iARB( GLint location,
GLint v0,
GLint v1,
GLint v2 )
void glUniform4iARB( GLint location,
GLint v0,
GLint v1,
GLint v3,
GLint v4 )
PARAMETERS
location Specify location for uniform variable to be modified.
v0, v1, v2, v3
Specify values for new uniform variable.
C SPECIFICATION
void glUniform1fvARB( GLuint location,
GLsizei *count,
const GLfloat *value )
void glUniform2fvARB( GLuint location,
GLsizei *count,
const GLfloat *value )
void glUniform3fvARB( GLuint location,
GLsizei *count,
const GLfloat *value )
void glUniform4fvARB( GLuint location,
GLsizei *count,
const GLfloat *value )
void glUniform1ivARB(
GLuint location,
GLsizei *count,
const GLint *value )
void glUniform2ivARB( GLuint location,
GLsizei *count,
const GLint *value )
void glUniform3ivARB( GLuint location,
GLsizei *count,
const GLint *value )
void glUniform4ivARB( GLuint location,
GLsizei *count,
const GLint *value )
PARAMETERS
location Specify location for uniform variable to be modified.
count Specifies the number of elements in the array.
value Specifies pointer to array containing values used to update
the uniform variable.
C SPECIFICATION
void glUniformMatrix2fvARB( GLuint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value )
void glUniformMatrix3fvARB( GLuint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value )
void glUniformMatrix4fvARB( GLuint location,
GLsizei count,
GLboolean transpose,
const GLfloat *value )
PARAMETERS
location Specify location for uniform array to be modified.
count Specifies the number of elements in the array.
transpose Specifies if the matrix should be transposed as it is loaded
into the uniform.
value Specifies pointer to array containing values used to update
the uniform array.
DESCRIPTION
glUniformARB sets the values for a uniform variable or a uniform array
for the program object which is currently in use (part of the OpenGL
rendering state). A Uniforms is referenced using its location which
can be queried by calling glGetUniformLocationARB. When a program
object is successfully linked all, locations are generated for all
active uniforms belonging to the program object and the uniform values
are initialized to zero. These locations are invalidated and new ones
assigned after each successful re-link.
Uniform variables and arrays are named and declared in a shader's
source code. Values for these uniforms remain constant over a primi‐
tive. Uniforms are program object specific state. They retain their
values once loaded, and their values are restored whenever a program
object is used, as long as the program object has not been re-linked. A
uniform is considered "active" if it is determined by the compiler and
linker that the uniform will actually be accessed when the executable
code is executed. In cases where the compiler and linker cannot make a
conclusive determination, the uniform will be considered active.
NOTES
Uniform variables which are defined as samplers can only be modified by
calling glUniform1iARB and glUniform1ivARB.
ERRORS
GL_INVALID_OPERATION is generated if there is no current program
object.
GL_INVALID_OPERATION is generated if the size of the uniform variable
in the shader does not match the size indicated in the glUniformARB
command.
GL_INVALID_OPERATION is generated if a sampler is loaded using a com‐
mand other than glUniform1iARB or glUniform1ivARB.
GL_INVALID_OPERATION is generated if the type of the variable declared
in the shader does not match that the type of the function used to load
the uniform variable.
GL_INVALID_OPERATION is generated if number of values used load the
variable is greater than the number of values declared in the shader.
GL_INVALID_OPERATION is generated if location is not a valid location
for the current program object.
GL_INVALID_OPERATION is generated if glUniformARB is executed between
the execution of glBegin and the corresponding execution of glEnd.
ASSOCIATED GETS
glGetUniformARB with the handle of a program object.
glGetUniformLocationARB with the handle of a program object and the
name of a uniform variable.
glGetUniform the handle of a program object and the location of a uni‐
form variable.
SEE ALSO
glDisable, glEnable, glLinkProgramARB, glUseProgramObjectARB
9 Mar 04 GLUNIFORM(3gl)