diff options
Diffstat (limited to 'files/zh-cn/web/api/webglrenderingcontext/gettexparameter/index.html')
| -rw-r--r-- | files/zh-cn/web/api/webglrenderingcontext/gettexparameter/index.html | 203 |
1 files changed, 203 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/webglrenderingcontext/gettexparameter/index.html b/files/zh-cn/web/api/webglrenderingcontext/gettexparameter/index.html new file mode 100644 index 0000000000..b37ddcbe37 --- /dev/null +++ b/files/zh-cn/web/api/webglrenderingcontext/gettexparameter/index.html @@ -0,0 +1,203 @@ +--- +title: WebGLRenderingContext.getTexParameter() +slug: Web/API/WebGLRenderingContext/getTexParameter +tags: + - API + - WebGL + - WebGL渲染上下文 + - 引用 + - 方法 + - 纹理 +translation_of: Web/API/WebGLRenderingContext/getTexParameter +--- +<div>{{APIRef("WebGL")}}</div> + +<p><strong><code>WebGLRenderingContext.getTexParameter()</code></strong> 此<a href="/en-US/docs/Web/API/WebGL_API">WebGL API</a>方法返回特定的纹理信息。</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">any <var>gl</var>.getTexParameter(<var>target</var>, <var>pname</var>); +</pre> + +<h3 id="参数">参数</h3> + +<dl> + <dt>target</dt> + <dd>一个 {{domxref("GLenum")}} 接口类型的绑定的点(target). 可能的值有: + <ul> + <li><code>gl.TEXTURE_2D</code>: 一个二维纹理.</li> + <li><code>gl.TEXTURE_CUBE_MAP</code>: 一个立方体纹理.</li> + <li>当使用 {{domxref("WebGL2RenderingContext", "WebGL 2 context", "", 1)}}接口, 可能会出现以下值: + <ul> + <li><code>gl.TEXTURE_3D</code>: 一个三维纹理.</li> + <li><code>gl.TEXTURE_2D_ARRAY</code>: 一个二维纹理数组.</li> + </ul> + </li> + </ul> + </dd> + <dt>pname</dt> + <dd>一个{{domxref("Glenum")}}接口类型的要查询的信息. 可能的值有: + <table class="standard-table"> + <thead> + <tr> + <th scope="col">pname</th> + <th scope="col">返回的类型</th> + <th scope="col">描述</th> + <th scope="col">可能返回的值</th> + </tr> + </thead> + <tbody> + <tr> + <th colspan="4">可用的WebGL 1的上下文</th> + </tr> + <tr> + <td><code>gl.TEXTURE_MAG_FILTER</code></td> + <td>{{domxref("GLenum")}}</td> + <td>纹理的放大滤镜</td> + <td><code>gl.LINEAR</code> (default value), <code>gl.NEAREST</code>.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_MIN_FILTER</code></td> + <td>{{domxref("GLenum")}}</td> + <td>纹理的缩小滤镜</td> + <td><code>gl.LINEAR</code>, <code>gl.NEAREST</code>, <code>gl.NEAREST_MIPMAP_NEAREST</code>, <code>gl.LINEAR_MIPMAP_NEAREST</code>, <code>gl.NEAREST</code>_MIPMAP_LINEAR (default value), <code>gl.LINEAR_MIPMAP_LINEAR</code>.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_WRAP_S</code></td> + <td>{{domxref("GLenum")}}</td> + <td> + <p>封装的纹理坐标方法<code>s(对应u坐标)</code></p> + </td> + <td><code>gl.REPEAT</code> (default value), <code>gl.CLAMP_TO_EDGE</code>, <code>gl.MIRRORED_REPEAT</code>.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_WRAP_T</code></td> + <td>{{domxref("GLenum")}}</td> + <td>封装的纹理坐标方法 <code>t(对应v坐标)</code></td> + <td><code>gl.REPEAT</code> (default value), <code>gl.CLAMP_TO_EDGE</code>, <code>gl.MIRRORED_REPEAT</code>.</td> + </tr> + <tr> + <th colspan="4">使用 {{domxref("EXT_texture_filter_anisotropic")}} 接口增加可用的扩展方法/属性</th> + </tr> + <tr> + <td><code>ext.TEXTURE_MAX_ANISOTROPY_EXT</code></td> + <td>{{domxref("GLfloat")}}</td> + <td>纹理所有方向的最大值</td> + <td>一个浮点型的任意值.</td> + </tr> + <tr> + <th colspan="4">使用WebGL 2上下文之后增加的可用方法/属性</th> + </tr> + <tr> + <td><code>gl.TEXTURE_BASE_LEVEL</code></td> + <td>{{domxref("GLint")}}</td> + <td>纹理贴图层级</td> + <td>一个整型任意值.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_COMPARE_FUNC</code></td> + <td>{{domxref("GLenum")}}</td> + <td>比较方法</td> + <td><code>gl.LEQUAL</code> (default value), <code>gl.GEQUAL</code>, <code>gl.LESS</code>, <code>gl.GREATER</code>, <code>gl.EQUAL</code>, <code>gl.NOTEQUAL</code>, <code>gl.ALWAYS</code>, <code>gl.NEVER</code>.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_COMPARE_MODE</code></td> + <td>{{domxref("GLenum")}}</td> + <td>纹理的比较模式</td> + <td><code>gl.NONE</code> (default value), <code>gl.COMPARE_REF_TO_TEXTURE</code>.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_IMMUTABLE_FORMAT</code></td> + <td>{{domxref("GLboolean")}}</td> + <td>纹理的格式和尺寸是否可变</td> + <td>true 或者 false.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_IMMUTABLE_LEVELS</code></td> + <td>{{domxref("GLuint")}}</td> + <td>纹理的可变等级</td> + <td>无符号整型任意值.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_MAX_LEVEL</code></td> + <td>{{domxref("GLint")}}</td> + <td>贴图数组层级的最大值</td> + <td>整型任意值.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_MAX_LOD</code></td> + <td>{{domxref("GLfloat")}}</td> + <td>纹理细致程度的最大值</td> + <td>浮点型任意值.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_MIN_LOD</code></td> + <td>{{domxref("GLfloat")}}</td> + <td>纹理细致程度的最小值</td> + <td>浮点型任意值.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_WRAP_R</code></td> + <td>{{domxref("GLenum")}}</td> + <td>封装的纹理坐标方法 <code>r</code></td> + <td><code>gl.REPEAT</code> (default value), <code>gl.CLAMP_TO_EDGE</code>, <code>gl.MIRRORED_REPEAT</code>.</td> + </tr> + </tbody> + </table> + </dd> +</dl> + +<h3 id="返回值">返回值</h3> + +<p>返回需要的纹理信息 (和 <code>pname</code>类型相同). 如果发生错误, 就返回{{jsxref("null")}}.</p> + +<h2 id="示例">示例</h2> + +<pre class="brush: js">gl.getTexParameter(gl.TEXTURE_2D, gl.TEXTURE_MAG_FILTER); +</pre> + +<h2 id="说明">说明</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">说明</th> + <th scope="col">状态</th> + <th scope="col">备注</th> + </tr> + <tr> + <td>{{SpecName('WebGL', "#5.14.8", "getTexParameter")}}</td> + <td>{{Spec2('WebGL')}}</td> + <td>最初的WebGL的定义.</td> + </tr> + <tr> + <td>{{SpecName('OpenGL ES 2.0', "glGetTexParameter.xml", "glGetTexParameter")}}</td> + <td>{{Spec2('OpenGL ES 2.0')}}</td> + <td>OpenGL ES 2.0 API的主页(相似).</td> + </tr> + <tr> + <td>{{SpecName('WebGL2', "#3.7.6", "getTexParameter")}}</td> + <td>{{Spec2('WebGL2')}}</td> + <td>升级的WebGL定义.</td> + </tr> + <tr> + <td>{{SpecName('OpenGL ES 3.0', "glGetTexParameter.xhtml", "glGetTexParameter")}}</td> + <td>{{Spec2('OpenGL ES 3.0')}}</td> + <td>OpenGL ES 3.0 API的主页(相似).</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p class="hidden">此页面的兼容性表格是根据结构化数据生成的. 如果你有兴趣贡献数据, 请查看 <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> 给我们发pull request.</p> + +<p>{{Compat("api.WebGLRenderingContext.getTexParameter")}}</p> + +<h2 id="相关链接">相关链接</h2> + +<ul> + <li>{{domxref("WebGLRenderingContext.texParameter", "WebGLRenderingContext.texParameterf()")}}</li> + <li>{{domxref("WebGLRenderingContext.texParameter", "WebGLRenderingContext.texParameteri()")}}</li> + <li>{{domxref("EXT_texture_filter_anisotropic")}}</li> +</ul> |
