EN
이 콘텐츠는 한국어로 제공되지 않아 영어 버전으로 표시됩니다.

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

 

 

표시:
© 2014 Microsoft