WebGLRenderingContext.texParameter[fi]() - Web APIs 编辑

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

Syntax

void gl.texParameterf(GLenum target, GLenum pname, GLfloat param);
void gl.texParameteri(GLenum target, GLenum pname, GLint param);

Parameters

target
A GLenum specifying the binding point (target). Possible values:
  • gl.TEXTURE_2D: A two-dimensional texture.
  • gl.TEXTURE_CUBE_MAP: A cube-mapped texture.
  • When using a WebGL 2 context, the following values are available additionally:
    • gl.TEXTURE_3D: A three-dimensional texture.
    • gl.TEXTURE_2D_ARRAY: A two-dimensional array texture.

The pname parameter is a Glenum specifying the texture parameter to set. The param parameter is a GLfloat or GLint specifying the value for the specified parameter pname.

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.

Examples

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

SpecificationStatusComment
WebGL 1.0
The definition of 'texParameter[fi]' in that specification.
RecommendationInitial definition for WebGL.
OpenGL ES 2.0
The definition of 'glTexParameter' in that specification.
StandardMan page of the (similar) OpenGL ES 2.0 API.
WebGL 2.0
The definition of 'texParameter[fi]' in that specification.
Editor's DraftUpdated definition for WebGL.
OpenGL ES 3.0
The definition of 'glTexParameter' in that specification.
StandardMan page of the (similar) OpenGL ES 3.0 API.

Browser compatibility

WebGLRenderingContext.texParameterf()

BCD tables only load in the browser

WebGLRenderingContext.texParameteri()

BCD tables only load in the browser

See also

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据

词条统计

浏览:74 次

字数:8259

最后编辑:6年前

编辑次数:0 次

    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文