GLGETUNIFORM(3G)
β¨ NAME β¨ β GLGETUNIFORM(3G), manual [FIXME: manual], bestie π
glGetUniformfv, glGetUniformiv β Returns the value of a uniform variable.
(And yes, the C spec below also brings the whole glGetUniformuiv, glGetUniformdv, and glGetnUniform* squad β they're all on this page, iykyk.)
π§ͺ C SPECIFICATION π§ͺ
void glGetUniformfv(GLuint program, GLint location, GLfloat *params);
void glGetUniformiv(GLuint program, GLint location, GLint *params);
void glGetUniformuiv(GLuint program, GLint location, GLuint *params);
void glGetUniformdv(GLuint program, GLint location, GLdouble *params);
void glGetnUniformfv(GLuint program, GLint location, GLsizei bufSize,
GLfloat *params);
void glGetnUniformiv(GLuint program, GLint location, GLsizei bufSize,
GLint *params);
void glGetnUniformuiv(GLuint program, GLint location, GLsizei bufSize,
GLuint *params);
void glGetnUniformdv(GLuint program, GLint location, GLsizei bufSize,
GLdouble *params);
π PARAMETERS π
programβ specifies the program object to be queried, bestie.locationβ specifies the location of the uniform variable to be queried.bufSizeβ specifies the size of the bufferparams.paramsβ returns the value of the specified uniform variable.
π¦ DESCRIPTION π¦
Okay so glGetUniform and glGetnUniform return in params the value(s) of the specified uniform variable. The type of the uniform variable specified by location determines the number of values returned, fr fr:
- If the uniform variable is defined in the shader as a boolean, int, or float, a single value will be returned.
- If it is defined as a
vec2,ivec2, orbvec2, two values will be returned. - If it is defined as a
vec3,ivec3, orbvec3, three values will be returned, and so on.
To query values stored in uniform variables declared as arrays, call glGetUniform for each element of the array. To query values stored in uniform variables declared as structures, call glGetUniform for each field in the structure. The values for uniform variables declared as a matrix will be returned in column major order. Periodt π
The locations assigned to uniform variables are not known until the program object is linked. After linking has occurred, the command glGetUniformLocation() can be used to obtain the location of a uniform variable. This location value can then be passed to glGetUniform or glGetnUniform in order to query the current value of the uniform variable. After a program object has been linked successfully, the index values for uniform variables remain fixed until the next link command occurs. The uniform variable values can only be queried after a link if the link was successful.
The only difference between glGetUniform and glGetnUniform is that glGetnUniform will generate an error if size of the params buffer, as described by bufSize, is not large enough to hold the result data.
πΈ NOTES πΈ
If an error is generated, no change is made to the contents of params. That part is lowkey important π
π ERRORS π
GL_INVALID_VALUEis generated ifprogramis not a value generated by OpenGL.GL_INVALID_OPERATIONis generated ifprogramis not a program object.GL_INVALID_OPERATIONis generated ifprogramhas not been successfully linked.GL_INVALID_OPERATIONis generated iflocationdoes not correspond to a valid uniform variable location for the specified program object.GL_INVALID_OPERATIONis generated byglGetnUniformif the buffer size required to store the requested data is greater thanbufSize.
π₯ ASSOCIATED GETS π₯
glGetActiveUniform()with argumentsprogramand the index of an active uniform variable.glGetProgram()with argumentsprogramandGL_ACTIVE_UNIFORMSorGL_ACTIVE_UNIFORM_MAX_LENGTH.glGetUniformLocation()with argumentsprogramand the name of a uniform variable.glIsProgram().
π VERSION SUPPORT π
Version vibe check: rows are Function / Feature Name, columns are OpenGL Version 2.0 through 4.5. All the βs and -s, exactly where the original puts them:
glGetUniformdvβ2.0-,2.1-,3.0-,3.1-,3.2-,3.3-,4.0β,4.1β,4.2β,4.3β,4.4β,4.5βglGetUniformfvβ2.0β,2.1β,3.0β,3.1β,3.2β,3.3β,4.0β,4.1β,4.2β,4.3β,4.4β,4.5βglGetUniformivβ2.0β,2.1β,3.0β,3.1β,3.2β,3.3β,4.0β,4.1β,4.2β,4.3β,4.4β,4.5βglGetUniformuivβ2.0-,2.1-,3.0β,3.1β,3.2β,3.3β,4.0β,4.1β,4.2β,4.3β,4.4β,4.5βglGetnUniformdvβ2.0-,2.1-,3.0-,3.1-,3.2-,3.3-,4.0-,4.1-,4.2-,4.3-,4.4-,4.5βglGetnUniformfvβ2.0-,2.1-,3.0-,3.1-,3.2-,3.3-,4.0-,4.1-,4.2-,4.3-,4.4-,4.5βglGetnUniformivβ2.0-,2.1-,3.0-,3.1-,3.2-,3.3-,4.0-,4.1-,4.2-,4.3-,4.4-,4.5βglGetnUniformuivβ2.0-,2.1-,3.0-,3.1-,3.2-,3.3-,4.0-,4.1-,4.2-,4.3-,4.4-,4.5β
π«Ά SEE ALSO π«Ά
glCreateProgram()glLinkProgram()glUniform()
π COPYRIGHT π
Copyright Β© 2003-2005 3Dlabs Inc. Ltd. Copyright Β© 2010-2014 Khronos Group. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1.0, 8 June 1999. http://opencontent.org/openpub/.
π COPYRIGHT (again, bestie) π
Copyright Β© 2003-2005 3Dlabs Inc. Ltd. Copyright Β© 2010-2014 Khronos Group.
Cute sign-off: source/version [FIXME: source], date 08/09/2021, page GLGETUNIFORM(3G) β mwah πβ¨
π¦ where this page comes from
- centos-stream 9: gl-manpages 1.1-24.20190306.el9 Β· MIT and Open Publication
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms