diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/webglrenderingcontext/texparameter | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/webglrenderingcontext/texparameter')
-rw-r--r-- | files/zh-cn/web/api/webglrenderingcontext/texparameter/index.html | 173 |
1 files changed, 173 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/webglrenderingcontext/texparameter/index.html b/files/zh-cn/web/api/webglrenderingcontext/texparameter/index.html new file mode 100644 index 0000000000..6d32ac62e4 --- /dev/null +++ b/files/zh-cn/web/api/webglrenderingcontext/texparameter/index.html @@ -0,0 +1,173 @@ +--- +title: 'WebGLRenderingContext.texParameter[fi]()' +slug: Web/API/WebGLRenderingContext/texParameter +translation_of: Web/API/WebGLRenderingContext/texParameter +--- +<div>{{APIRef("WebGL")}}</div> + +<p><a href="/en-US/docs/Web/API/WebGL_API">WebGL API</a> 的<strong><code>WebGLRenderingContext.texParameter[fi]()</code></strong>方法用于设置纹理参数.</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">void <var>gl</var>.texParameterf(GLenum <var>target</var>, GLenum <var>pname</var>, GLfloat <var>param</var>); +void <var>gl</var>.texParameteri(GLenum <var>target</var>, GLenum <var>pname</var>, GLint <var>param</var>); +</pre> + +<h3 id="参数">参数</h3> + +<dl> + <dt>target</dt> + <dd>{{domxref("GLenum")}} 指定绑定点(目标)。可能的值:</dd> + <dd> + <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> +</dl> + +<p><code>pname</code> 参数是 {{domxref("Glenum")}} 指定要设置的纹理参数. <code>param</code> 参数是 {{domxref("GLfloat")}} 或 {{domxref("GLint")}} 已指定的 <code>pname</code>参数的值。</p> + +<table class="standard-table"> + <thead> + <tr> + <th scope="col"><code>pname</code></th> + <th scope="col">描述</th> + <th scope="col"><code>参数</code></th> + </tr> + </thead> + <tbody> + <tr> + <th colspan="3">Available in WebGL 1</th> + </tr> + <tr> + <td><code>gl.TEXTURE_MAG_FILTER</code></td> + <td>纹理放大滤波器</td> + <td><code>gl.LINEAR</code> (默认值), <code>gl.NEAREST</code>.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_MIN_FILTER</code></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_MIPMAP_LINEAR</code> (默认值), <code>gl.LINEAR_MIPMAP_LINEAR</code>.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_WRAP_S</code></td> + <td>纹理坐标水平填充 <code>s</code></td> + <td><code>gl.REPEAT</code> (默认值),<code>gl.CLAMP_TO_EDGE</code>, <code>gl.MIRRORED_REPEAT</code>.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_WRAP_T</code></td> + <td>纹理坐标垂直填充 <code>t</code></td> + <td><code>gl.REPEAT</code> (默认值),<code>gl.CLAMP_TO_EDGE</code>, <code>gl.MIRRORED_REPEAT</code>.</td> + </tr> + <tr> + <th colspan="3">Additionally available when using the {{domxref("EXT_texture_filter_anisotropic")}} extension</th> + </tr> + <tr> + <td><code>ext.TEXTURE_MAX_ANISOTROPY_EXT</code></td> + <td>纹理最大向异性</td> + <td> {{domxref("GLfloat")}} 值.</td> + </tr> + <tr> + <th colspan="3">Additionally available when using a WebGL 2 context</th> + </tr> + <tr> + <td><code>gl.TEXTURE_BASE_LEVEL</code></td> + <td>纹理映射等级</td> + <td>任何整型值.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_COMPARE_FUNC</code></td> + <td>纹理对比函数</td> + <td><code>gl.LEQUAL</code> (默认值), <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>纹理对比模式</td> + <td><code>gl.NONE</code> (默认值), <code>gl.COMPARE_REF_TO_TEXTURE</code>.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_MAX_LEVEL</code></td> + <td>最大纹理映射数组等级</td> + <td>任何整型值.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_MAX_LOD</code></td> + <td>纹理最大细节层次值</td> + <td>任何整型值.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_MIN_LOD</code></td> + <td>纹理最小细节层次值</td> + <td>任何浮点型值.</td> + </tr> + <tr> + <td><code>gl.TEXTURE_WRAP_R</code></td> + <td>纹理坐标<code>r</code>包装功能</td> + <td><code>gl.REPEAT</code> (默认值), <code>gl.CLAMP_TO_EDGE</code>, <code>gl.MIRRORED_REPEAT</code>.</td> + </tr> + </tbody> +</table> + +<h3 id="返回值">返回值</h3> + +<p><code>INVALID_ENUM </code>target不是合法的值。</p> + +<p><code>INVALID_OPRATION </code>当前目标上没有绑定纹理对象。</p> + +<h2 id="示例">示例</h2> + +<pre class="brush: 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); +</pre> + +<h2 id="说明">说明</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('WebGL', "#5.14.8", "texParameter[fi]")}}</td> + <td>{{Spec2('WebGL')}}</td> + <td>WebGL初始定义.</td> + </tr> + <tr> + <td>{{SpecName('OpenGL ES 2.0', "glTexParameter.xml", "glTexParameter")}}</td> + <td>{{Spec2('OpenGL ES 2.0')}}</td> + <td>OpenGL ES 2.0 API手册(类似).</td> + </tr> + <tr> + <td>{{SpecName('WebGL2', "#3.7.6", "texParameter[fi]")}}</td> + <td>{{Spec2('WebGL2')}}</td> + <td>WebGL更新定义.</td> + </tr> + <tr> + <td>{{SpecName('OpenGL ES 3.0', "glTexParameter.xhtml", "glTexParameter")}}</td> + <td>{{Spec2('OpenGL ES 3.0')}}</td> + <td>OpenGL ES 3.0 API手册(类似).</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("api.WebGLRenderingContext.texParameterf")}}</p> + +<h2 id="另见">另见</h2> + +<ul> + <li>{{domxref("WebGLRenderingContext.getTexParameter()")}}</li> + <li>{{domxref("EXT_texture_filter_anisotropic")}}</li> +</ul> |