WebGLRenderingContext.getTexParameter() - Web APIs 编辑

The WebGLRenderingContext.getTexParameter() method of the WebGL API returns information about the given texture.

Syntax

any gl.getTexParameter(target, pname);

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.
pname
A Glenum specifying the information to query. Possible values:
pnameReturn typeDescriptionPossible return values
Available in a WebGL 1 context
gl.TEXTURE_MAG_FILTERGLenumTexture magnification filtergl.LINEAR (default value), gl.NEAREST.
gl.TEXTURE_MIN_FILTERGLenumTexture 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_SGLenumWrapping function for texture coordinate sgl.REPEAT (default value), gl.CLAMP_TO_EDGE, gl.MIRRORED_REPEAT.
gl.TEXTURE_WRAP_TGLenumWrapping 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_EXTGLfloatMaximum anisotropy for a textureAny float values.
Additionally available when using a WebGL 2 context
gl.TEXTURE_BASE_LEVELGLintTexture mipmap levelAny int values.
gl.TEXTURE_COMPARE_FUNCGLenumComparison functiongl.LEQUAL (default value), gl.GEQUAL, gl.LESS, gl.GREATER, gl.EQUAL, gl.NOTEQUAL, gl.ALWAYS, gl.NEVER.
gl.TEXTURE_COMPARE_MODEGLenumTexture comparison modegl.NONE (default value), gl.COMPARE_REF_TO_TEXTURE.
gl.TEXTURE_IMMUTABLE_FORMATGLbooleanImmutability of the texture format and sizetrue or false.
gl.TEXTURE_IMMUTABLE_LEVELSGLuint?Any uint values.
gl.TEXTURE_MAX_LEVELGLintMaximum texture mipmap array levelAny int values.
gl.TEXTURE_MAX_LODGLfloatTexture maximum level-of-detail valueAny float values.
gl.TEXTURE_MIN_LODGLfloatTexture minimum level-of-detail valueAny float values.
gl.TEXTURE_WRAP_RGLenumWrapping function for texture coordinate rgl.REPEAT (default value), gl.CLAMP_TO_EDGE, gl.MIRRORED_REPEAT.

Return value

Returns the requested texture information (as specified with pname). If an error occurs, null is returned.

Examples

gl.getTexParameter(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER);

Specifications

SpecificationStatusComment
WebGL 1.0
The definition of 'getTexParameter' in that specification.
RecommendationInitial definition for WebGL.
OpenGL ES 2.0
The definition of 'glGetTexParameter' in that specification.
StandardMan page of the (similar) OpenGL ES 2.0 API.
WebGL 2.0
The definition of 'getTexParameter' in that specification.
Editor's DraftUpdated definition for WebGL.
OpenGL ES 3.0
The definition of 'glGetTexParameter' in that specification.
StandardMan page of the (similar) OpenGL ES 3.0 API.

Browser compatibility

BCD tables only load in the browser

See also

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

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

发布评论

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

词条统计

浏览:121 次

字数:9768

最后编辑:7 年前

编辑次数:0 次

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