glUniform

Specify the value of a uniform variable for the current program object

Signature

glUniform1f( GLint ( location ) , GLfloat ( v0 ) )-> void
glUniform1f( location , v0 )
glUniform1fv( GLint ( location ) , GLsizei ( count ) , const GLfloat *( value ) )-> void
glUniform1fv( location , count , value )
glUniform1i( GLint ( location ) , GLint ( v0 ) )-> void
glUniform1i( location , v0 )
glUniform1iv( GLint ( location ) , GLsizei ( count ) , const GLint *( value ) )-> void
glUniform1iv( location , count , value )
glUniform1ui( GLint ( location ) , GLuint ( v0 ) )-> void
glUniform1ui( location , v0 )
glUniform1uiv( GLint ( location ) , GLsizei ( count ) , const GLuint *( value ) )-> void
glUniform1uiv( location , count , value )
glUniform2f( GLint ( location ) , GLfloat ( v0 ) , GLfloat ( v1 ) )-> void
glUniform2f( location , v0 , v1 )
glUniform2fv( GLint ( location ) , GLsizei ( count ) , const GLfloat *( value ) )-> void
glUniform2fv( location , count , value )
glUniform2i( GLint ( location ) , GLint ( v0 ) , GLint ( v1 ) )-> void
glUniform2i( location , v0 , v1 )
glUniform2iv( GLint ( location ) , GLsizei ( count ) , const GLint *( value ) )-> void
glUniform2iv( location , count , value )
glUniform2ui( GLint ( location ) , GLuint ( v0 ) , GLuint ( v1 ) )-> void
glUniform2ui( location , v0 , v1 )
glUniform2uiv( GLint ( location ) , GLsizei ( count ) , const GLuint *( value ) )-> void
glUniform2uiv( location , count , value )
glUniform3f( GLint ( location ) , GLfloat ( v0 ) , GLfloat ( v1 ) , GLfloat ( v2 ) )-> void
glUniform3f( location , v0 , v1 , v2 )
glUniform3fv( GLint ( location ) , GLsizei ( count ) , const GLfloat *( value ) )-> void
glUniform3fv( location , count , value )
glUniform3i( GLint ( location ) , GLint ( v0 ) , GLint ( v1 ) , GLint ( v2 ) )-> void
glUniform3i( location , v0 , v1 , v2 )
glUniform3iv( GLint ( location ) , GLsizei ( count ) , const GLint *( value ) )-> void
glUniform3iv( location , count , value )
glUniform3ui( GLint ( location ) , GLuint ( v0 ) , GLuint ( v1 ) , GLuint ( v2 ) )-> void
glUniform3ui( location , v0 , v1 , v2 )
glUniform3uiv( GLint ( location ) , GLsizei ( count ) , const GLuint *( value ) )-> void
glUniform3uiv( location , count , value )
glUniform4f( GLint ( location ) , GLfloat ( v0 ) , GLfloat ( v1 ) , GLfloat ( v2 ) , GLfloat ( v3 ) )-> void
glUniform4f( location , v0 , v1 , v2 , v3 )
glUniform4fv( GLint ( location ) , GLsizei ( count ) , const GLfloat *( value ) )-> void
glUniform4fv( location , count , value )
glUniform4i( GLint ( location ) , GLint ( v0 ) , GLint ( v1 ) , GLint ( v2 ) , GLint ( v3 ) )-> void
glUniform4i( location , v0 , v1 , v2 , v3 )
glUniform4iv( GLint ( location ) , GLsizei ( count ) , const GLint *( value ) )-> void
glUniform4iv( location , count , value )
glUniform4ui( GLint ( location ) , GLuint ( v0 ) , GLuint ( v1 ) , GLuint ( v2 ) , GLuint ( v3 ) )-> void
glUniform4ui( location , v0 , v1 , v2 , v3 )
glUniform4uiv( GLint ( location ) , GLsizei ( count ) , const GLuint *( value ) )-> void
glUniform4uiv( location , count , value )
glUniformMatrix2fv( GLint ( location ) , GLsizei ( count ) , GLboolean ( transpose ) , const GLfloat *( value ) )-> void
glUniformMatrix2fv( location , count , transpose , value )
glUniformMatrix2x3fv( GLint ( location ) , GLsizei ( count ) , GLboolean ( transpose ) , const GLfloat *( value ) )-> void
glUniformMatrix2x3fv( location , count , transpose , value )
glUniformMatrix2x4fv( GLint ( location ) , GLsizei ( count ) , GLboolean ( transpose ) , const GLfloat *( value ) )-> void
glUniformMatrix2x4fv( location , count , transpose , value )
glUniformMatrix3fv( GLint ( location ) , GLsizei ( count ) , GLboolean ( transpose ) , const GLfloat *( value ) )-> void
glUniformMatrix3fv( location , count , transpose , value )
glUniformMatrix3x2fv( GLint ( location ) , GLsizei ( count ) , GLboolean ( transpose ) , const GLfloat *( value ) )-> void
glUniformMatrix3x2fv( location , count , transpose , value )
glUniformMatrix3x4fv( GLint ( location ) , GLsizei ( count ) , GLboolean ( transpose ) , const GLfloat *( value ) )-> void
glUniformMatrix3x4fv( location , count , transpose , value )
glUniformMatrix4fv( GLint ( location ) , GLsizei ( count ) , GLboolean ( transpose ) , const GLfloat *( value ) )-> void
glUniformMatrix4fv( location , count , transpose , value )
glUniformMatrix4x2fv( GLint ( location ) , GLsizei ( count ) , GLboolean ( transpose ) , const GLfloat *( value ) )-> void
glUniformMatrix4x2fv( location , count , transpose , value )
glUniformMatrix4x3fv( GLint ( location ) , GLsizei ( count ) , GLboolean ( transpose ) , const GLfloat *( value ) )-> void
glUniformMatrix4x3fv( location , count , transpose , value )

Parameters

VariablesDescription
location
Specifies the location of the uniform variable to be modified.
count
For the vector ( glUniform*v ) commands, specifies the number of elements that are to be modified. This should be 1 if the targeted uniform variable is not an array, and 1 or more if it is an array.
transpose
For the matrix commands, specifies whether to transpose the matrix as the values are loaded into the uniform variable.
v0, v1, v2, v3
For the scalar commands, specifies the new values to be used for the specified uniform variable.
value
For the vector and matrix commands, specifies a pointer to an array of count values that will be used to update the specified uniform variable.

Sample Code References

The following code samples have been found which appear to reference the functions described here. Take care that the code may be old, broken or not even use PyOpenGL.

glUniform1f
OpenGLContext tests/shader_8.py Lines: 232
OpenGLContext tests/shader_10.py Lines: 310
OpenGLContext tests/shader_9.py Lines: 365
OpenGLContext tests/shader_3.py Lines: 155
OpenGLContext tests/shader_6.py Lines: 287
OpenGLContext tests/shader_11.py Lines: 279, 290
OpenGLContext tests/shader_7.py Lines: 315
OpenGLContext tests/shader_4.py Lines: 121
{LGPL} PyMT pymt/graphx/shader.py Lines: 11, 62
Visvis core/shaders.py Lines: 487
glUniform1i
OpenGLContext tests/shader_11.py Lines: 262
OpenGLContext tests/pygame_textureatlas.py Lines: 132
OpenGLContext OpenGLContext/scenegraph/shaders.py Lines: 216, 230
{LGPL} PyMT pymt/graphx/shader.py Lines: 10, 66
Visvis core/shaders.py Lines: 519
{GPL3} OpenGL-Programmable 06-perpixel.py Lines: 113, 263, 267
{GPL3} OpenGL-Programmable 09-gles2.py Lines: 140, 317, 321
{GPL3} OpenGL-Programmable 10-gl3.2core.py Lines: 148, 327, 331
{GPL3} OpenGL-Programmable 08-pbo.py Lines: 122, 296, 300
{GPL3} OpenGL-Programmable 05-shader.py Lines: 105, 255, 259
{GPL3} OpenGL-Programmable 07-attrib.py Lines: 122, 274, 278
glUniform2f
Visvis core/shaders.py Lines: 489
glUniform2i
Visvis core/shaders.py Lines: 521
glUniform3f
OpenGLContext tests/shader_8.py Lines: 230
OpenGLContext tests/shader_10.py Lines: 308
OpenGLContext tests/shader_9.py Lines: 363
OpenGLContext tests/shader_6.py Lines: 277
OpenGLContext tests/shader_11.py Lines: 288
OpenGLContext tests/shader_5.py Lines: 298
OpenGLContext tests/shader_7.py Lines: 313
OpenGLContext tests/pygame_textureatlas.py Lines: 133
Visvis core/shaders.py Lines: 491
glUniform3fv
OpenGLContext tests/shaders.py Lines: 27
glUniform3i
Visvis core/shaders.py Lines: 523
glUniform4f
OpenGLContext tests/shader_8.py Lines: 228
OpenGLContext tests/shader_10.py Lines: 306
OpenGLContext tests/shader_9.py Lines: 361
OpenGLContext tests/shader_3.py Lines: 156
OpenGLContext tests/shader_6.py Lines: 270, 271, 272, 276, 279, 280, 286
OpenGLContext tests/shader_11.py Lines: 286
OpenGLContext tests/shader_5.py Lines: 293, 296, 297, 300, 301
OpenGLContext tests/shader_7.py Lines: 311
Visvis core/shaders.py Lines: 493
{GPL3} OpenGL-Programmable 09-gles2.py Lines: 390
{GPL3} OpenGL-Programmable 10-gl3.2core.py Lines: 400
glUniform4fv
OpenGLContext tests/shader_8.py Lines: 219
OpenGLContext tests/shader_10.py Lines: 297
OpenGLContext tests/shader_9.py Lines: 352
OpenGLContext tests/shader_11.py Lines: 269, 281
OpenGLContext tests/shader_7.py Lines: 299
glUniform4i
Visvis core/shaders.py Lines: 525
glUniformMatrix3fv
{GPL3} OpenGL-Programmable 09-gles2.py Lines: 241
{GPL3} OpenGL-Programmable 10-gl3.2core.py Lines: 251
glUniformMatrix4fv
{GPL3} OpenGL-Programmable 09-gles2.py Lines: 177, 237, 288
{GPL3} OpenGL-Programmable 10-gl3.2core.py Lines: 185, 247, 298