WebGLRenderingContext.uniform[1234][fi][v]()
 The WebGLRenderingContext.uniform[1234][fi][v]() methods of the WebGL API specify values of uniform variables. All active uniform variables defined in a program object are initialized to 0 when the program object is linked successfully. They retain the values assigned to them by a call to this method until the next successful link operation occurs on the program object, when they are once again initialized to 0. 
 Note: Many of the functions described here have expanded WebGL 2 interfaces, which can be found under WebGL2RenderingContext.uniform[1234][uif][v](). 
Syntax
void gl.uniform1f(location, v0); void gl.uniform1fv(location, value); void gl.uniform1i(location, v0); void gl.uniform1iv(location, value); void gl.uniform2f(location, v0, v1); void gl.uniform2fv(location, value); void gl.uniform2i(location, v0, v1); void gl.uniform2iv(location, value); void gl.uniform3f(location, v0, v1, v2); void gl.uniform3fv(location, value); void gl.uniform3i(location, v0, v1, v2); void gl.uniform3iv(location, value); void gl.uniform4f(location, v0, v1, v2, v3); void gl.uniform4fv(location, value); void gl.uniform4i(location, v0, v1, v2, v3); void gl.uniform4iv(location, value);
Parameters
- location
-  A WebGLUniformLocationobject containing the location of the uniform attribute to modify.
- value, v0, v1, v2, v3
-  A new value to be used for the uniform variable. Possible types: -  A floating point Numberfor floating point values (methods with "f").
-  A sequence of floating point numbers (for example a Float32Arrayor anArrayof numbers) for floating point vector methods (methods with "fv").
- An integer Numberfor integer values (methods with "i").
- An Int32Arrayfor integer vector methods (methods with "iv").
 
-  A floating point 
Return value
None.
Examples
gl.uniform1f(u_alpha, 0.8);
Specifications
| Specification | 
|---|
| WebGL Specification (WebGL) # 5.14.10 | 
Browser compatibility
| Desktop | Mobile | |||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Chrome | Edge | Firefox | Internet Explorer | Opera | Safari | WebView Android | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | |
| uniform | 9 | 12 | 4 | 11 | 12 | 5.1 | ≤37 | 25 | Yes | 12 | 8 | 1.5 | 
See also
    © 2005–2021 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
    https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/uniform