Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
Export (0) Print
Expand All
Expand Minimize

getUniform method

Gets the uniform value for a specific location in a program.

IE11

 

Syntax

var retVal = WebGLRenderingContext.getUniform(program, location);

Parameters

program [in]

Type: WebGLProgram

The program to query.

location [in]

Type: WebGLUniformLocation

The location of the uniform variable.

Return value

Type: any

One of the following. Returns null if a WebGL error is generated.

Uniform typeretVal type
booleanBoolean
intNumber
floatNumber
vec2Float32Array(with 2 elements)
ivec2Int32Array(with 2 elements)
bvec2Array containing Boolean (with 2 elements)
vec3Float32Array(with 3 elements)
ivec3Int32Array(with 3 elements)
bvec3Array containing Boolean (with 3 elements)
vec4Float32Array(with 4 elements)
ivec4Int32Array(with 4 elements)
bvec4Array containing Boolean (with 4 elements)
mat2Float32Array(with 4 elements)
mat3Float32Array(with 9 elements)
mat4Float32Array(with 16 elements)
sampler2DNumber
samplerCubeNumber

 

Remarks

WebGL ErrorDescription
gl.INVALID_VALUEIf program is not generated by WebGL.
gl.INVALID_OPERATION
  • If location isn't a valid uniform variable location for program
  • If program is not a program object.
  • if program isn't successfully linked.

 

See also

WebGLRenderingContext

 

 

Show:
© 2015 Microsoft