Was this page helpful?
Your feedback about this content is important. Let us know what you think.
Additional feedback?
1500 characters remaining
uniform1i
Collapse the table of content
Expand the table of content

uniform1i method

Assigns an integer value to a uniform variable for the current program object.

IE11

 

Syntax

WebGLRenderingContext.uniform1i(location, value);

Parameters

location [in]

Type: WebGLUniformLocation

Specifies the location of the uniform to modify.

value [in]

Type: Number

The new value for the uniform variable.

A numeric value
false
true

Return value

This method does not return a value.

Remarks

Uniform1i can be used to set texture samplers. If location is a texture sampler, then value refers to an offset into the array of active textures.

WebGL errorDescription
gl.INVALID_OPERATION
  • The location doesn't belong to the current program.
  • There is no current program object.
  • If location is an invalid location for the current program object and location isn't equal to -1.

 

Examples

The following example uses uniform1i . For more info on this example, see Get started with WebGL.


// Set up uniforms variables (image).
this.pictureprogram.u_image = gl.getUniformLocation(this.pictureprogram, "u_image");

// Set the texture to use.
gl.uniform1i(this.pictureprogram.u_image, 0);


See also

WebGLRenderingContext

 

 

Show:
© 2015 Microsoft