WebGLRenderingContext: texParameter[fi]() method

Note: This feature is available in Web Workers.

The WebGLRenderingContext.texParameter[fi]() methods of the WebGL API set texture parameters.

Syntax

js
texParameterf(target, pname, param)
texParameteri(target, pname, param)

Parameters

target

A GLenum specifying the binding point (target). Possible values:

When using a WebGL 2 context, the following values are available additionally:

param

The param parameter is a GLfloat or GLint specifying the value for the specified parameter

pname

The pname parameter is a GLenum specifying the texture parameter to set.

pnameDescriptionparam
Available in WebGL 1
gl.TEXTURE_MAG_FILTERTexture magnification filtergl.LINEAR (default value), gl.NEAREST.
gl.TEXTURE_MIN_FILTERTexture minification filtergl.LINEAR, gl.NEAREST, gl.NEAREST_MIPMAP_NEAREST, gl.LINEAR_MIPMAP_NEAREST, gl.NEAREST_MIPMAP_LINEAR (default value), gl.LINEAR_MIPMAP_LINEAR.
gl.TEXTURE_WRAP_SWrapping function for texture coordinate sgl.REPEAT (default value), gl.CLAMP_TO_EDGE, gl.MIRRORED_REPEAT.
gl.TEXTURE_WRAP_TWrapping function for texture coordinate tgl.REPEAT (default value), gl.CLAMP_TO_EDGE, gl.MIRRORED_REPEAT.
Additionally available when using the EXT_texture_filter_anisotropic extension
ext.TEXTURE_MAX_ANISOTROPY_EXTMaximum anisotropy for a textureA GLfloat value.
Additionally available when using a WebGL 2 context
gl.TEXTURE_BASE_LEVELTexture mipmap levelAny int values.
gl.TEXTURE_COMPARE_FUNCTexture Comparison functiongl.LEQUAL (default value), gl.GEQUAL, gl.LESS, gl.GREATER, gl.EQUAL, gl.NOTEQUAL, gl.ALWAYS, gl.NEVER.
gl.TEXTURE_COMPARE_MODETexture comparison modegl.NONE (default value), gl.COMPARE_REF_TO_TEXTURE.
gl.TEXTURE_MAX_LEVELMaximum texture mipmap array levelAny int values.
gl.TEXTURE_MAX_LODTexture maximum level-of-detail valueAny float values.
gl.TEXTURE_MIN_LODTexture minimum level-of-detail valueAny float values.
gl.TEXTURE_WRAP_RWrapping function for texture coordinate rgl.REPEAT (default value), gl.CLAMP_TO_EDGE, gl.MIRRORED_REPEAT.

Return value

None (undefined).

Examples

js
gl.texParameterf(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER, gl.LINEAR);
gl.texParameteri(
  gl.TEXTURE_2D,
  gl.TEXTURE_MIN_FILTER,
  gl.LINEAR_MIPMAP_NEAREST,
);

Specifications

Browser compatibility

undefined

See also