aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/webglrenderingcontext/isenabled/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/webglrenderingcontext/isenabled/index.html')
-rw-r--r--files/zh-cn/web/api/webglrenderingcontext/isenabled/index.html193
1 files changed, 193 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/webglrenderingcontext/isenabled/index.html b/files/zh-cn/web/api/webglrenderingcontext/isenabled/index.html
new file mode 100644
index 0000000000..9c87ead999
--- /dev/null
+++ b/files/zh-cn/web/api/webglrenderingcontext/isenabled/index.html
@@ -0,0 +1,193 @@
+---
+title: WebGLRenderingContext.isEnabled()
+slug: Web/API/WebGLRenderingContext/isEnabled
+translation_of: Web/API/WebGLRenderingContext/isEnabled
+---
+<div>{{APIRef("WebGL")}}</div>
+
+<p><strong><code>WebGLRenderingContext.isEnabled()</code></strong> 是 <a href="/en-US/docs/Web/API/WebGL_API">WebGL API</a> 方法之一,用来检测给定的 WebGL 功能项在当前上下文是否可用。</p>
+
+<p>默认的,除了 <code>gl.DITHER</code>,所有的功能项都是未启用的。</p>
+
+<h2 id="句法">句法</h2>
+
+<pre class="syntaxbox">void <var>gl</var>.isEnabled(<var>cap</var>);
+</pre>
+
+<h3 id="参数">参数</h3>
+
+<dl>
+ <dt><code>cap</code></dt>
+ <dd>{{domxref("GLenum")}} 指定待检测的 WebGL 功能项。可能的值有:</dd>
+ <dd>
+ <table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Constant</th>
+ <th scope="col">Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>gl.BLEND</code></td>
+ <td>Blending of the computed fragment color values. See {{domxref("WebGLRenderingContext.blendFunc()")}}.</td>
+ </tr>
+ <tr>
+ <td><code>gl.CULL_FACE</code></td>
+ <td>Culling of polygons. See {{domxref("WebGLRenderingContext.cullFace()")}}.</td>
+ </tr>
+ <tr>
+ <td><code>gl.DEPTH_TEST</code></td>
+ <td>Depth comparisons and updates to the depth buffer. See {{domxref("WebGLRenderingContext.depthFunc()")}}.</td>
+ </tr>
+ <tr>
+ <td><code>gl.DITHER</code></td>
+ <td>Dithering of color components before they get written to the color buffer.</td>
+ </tr>
+ <tr>
+ <td><code>gl.POLYGON_OFFSET_FILL</code></td>
+ <td>Adding an offset to depth values of polygon's fragments. See {{domxref("WebGLRenderingContext.polygonOffset()")}}.</td>
+ </tr>
+ <tr>
+ <td><code>gl.SAMPLE_ALPHA_TO_COVERAGE</code></td>
+ <td>Computation of a temporary coverage value determined by the alpha value.</td>
+ </tr>
+ <tr>
+ <td><code>gl.SAMPLE_COVERAGE</code></td>
+ <td>ANDing the fragment's coverage with the temporary coverage value. See {{domxref("WebGLRenderingContext.sampleCoverage()")}}.</td>
+ </tr>
+ <tr>
+ <td><code>gl.SCISSOR_TEST</code></td>
+ <td>Scissor test that discards fragments that are outside of the scissor rectangle. See {{domxref("WebGLRenderingContext.scissor()")}}.</td>
+ </tr>
+ <tr>
+ <td><code>gl.STENCIL_TEST</code></td>
+ <td>Stencil testing and updates to the stencil buffer. See {{domxref("WebGLRenderingContext.stencilFunc()")}}.</td>
+ </tr>
+ </tbody>
+ </table>
+ 当使用 {{domxref("WebGL2RenderingContext", "WebGL 2 context", "", 1)}} 的时候,下列附加的值也是可选用的。
+
+ <table class="standard-table">
+ <thead>
+ <tr>
+ <th scope="col">Constant</th>
+ <th scope="col">Description</th>
+ </tr>
+ </thead>
+ <tbody>
+ <tr>
+ <td><code>gl.RASTERIZER_DISCARD</code></td>
+ <td>Primitives are discarded immediately before the rasterization stage, but after the optional transform feedback stage. <code>gl.clear()</code> commands are ignored.</td>
+ </tr>
+ </tbody>
+ </table>
+ </dd>
+</dl>
+
+<h3 id="返回值">返回值</h3>
+
+<p>{{domxref("GLboolean")}} 指示能力项 <em>cap </em>可用 (<code>true</code>),不可用 (<code>false</code>)。</p>
+
+<h2 id="示例">示例</h2>
+
+<pre class="brush: js">gl.isEnabled(gl.STENCIL_TEST);
+// false
+</pre>
+
+<p>启用或停用给定的能力项,使用 {{domxref("WebGLRenderingContext.enable()")}} 方法和 {{domxref("WebGLRenderingContext.disable()")}} 方法:</p>
+
+<pre class="brush: js">gl.enable(gl.STENCIL_TEST);
+gl.disable(gl.STENCIL_TEST);
+</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.3", "isEnabled")}}</td>
+ <td>{{Spec2('WebGL')}}</td>
+ <td>Initial definition for WebGL.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('OpenGL ES 2.0', "glIsEnabled.xml", "glIsEnabled")}}</td>
+ <td>{{Spec2('OpenGL ES 2.0')}}</td>
+ <td>Man page of the (similar) OpenGL ES 2.0 API.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('WebGL2', "#3.7.2", "isEnabled")}}</td>
+ <td>{{Spec2('WebGL2')}}</td>
+ <td>Updated definition for WebGL 2.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('OpenGL ES 3.0', "glIsEnabled.xhtml", "glIsEnabled")}}</td>
+ <td>{{Spec2('OpenGL ES 3.0')}}</td>
+ <td>Man page of the (similar) OpenGL ES 3.0 API.</td>
+ </tr>
+ </tbody>
+</table>
+
+<h2 id="浏览器兼容性">浏览器兼容性</h2>
+
+<div>{{CompatibilityTable}}</div>
+
+<div id="compat-desktop">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Chrome</th>
+ <th>Firefox (Gecko)</th>
+ <th>Internet Explorer</th>
+ <th>Opera</th>
+ <th>Safari</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatChrome("9")}}</td>
+ <td>{{CompatGeckoDesktop("2.0")}}</td>
+ <td>{{CompatIE("11")}}</td>
+ <td>{{CompatOpera("12")}}</td>
+ <td>{{CompatSafari("5.1")}}</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<div id="compat-mobile">
+<table class="compat-table">
+ <tbody>
+ <tr>
+ <th>Feature</th>
+ <th>Android</th>
+ <th>Chrome for Android</th>
+ <th>Firefox Mobile (Gecko)</th>
+ <th>IE Mobile</th>
+ <th>Opera Mobile</th>
+ <th>Safari Mobile</th>
+ </tr>
+ <tr>
+ <td>Basic support</td>
+ <td>{{CompatUnknown}}</td>
+ <td>25</td>
+ <td>{{CompatVersionUnknown}}</td>
+ <td>{{CompatUnknown}}</td>
+ <td>12</td>
+ <td>8.1</td>
+ </tr>
+ </tbody>
+</table>
+</div>
+
+<h2 id="另见">另见</h2>
+
+<ul>
+ <li>{{domxref("WebGLRenderingContext.enable()")}}</li>
+ <li>{{domxref("WebGLRenderingContext.disable()")}}</li>
+</ul>