aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/webglrenderingcontext/disable/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/webglrenderingcontext/disable/index.html')
-rw-r--r--files/zh-cn/web/api/webglrenderingcontext/disable/index.html139
1 files changed, 139 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/webglrenderingcontext/disable/index.html b/files/zh-cn/web/api/webglrenderingcontext/disable/index.html
new file mode 100644
index 0000000000..c1717db568
--- /dev/null
+++ b/files/zh-cn/web/api/webglrenderingcontext/disable/index.html
@@ -0,0 +1,139 @@
+---
+title: WebGLRenderingContext.disable()
+slug: Web/API/WebGLRenderingContext/disable
+translation_of: Web/API/WebGLRenderingContext/disable
+---
+<div>{{APIRef("WebGL")}}</div>
+
+<p>The <strong><code>WebGLRenderingContext.disable()</code></strong> method of the <a href="/en-US/docs/Web/API/WebGL_API">WebGL API</a> disables specific WebGL capabilities for this context.</p>
+
+<h2 id="Syntax">Syntax</h2>
+
+<pre class="syntaxbox">void <var>gl</var>.disable(<var>cap</var>);
+</pre>
+
+<h3 id="Parameters">Parameters</h3>
+
+<dl>
+ <dt><code>cap</code></dt>
+ <dd>A {{domxref("GLenum")}} specifying which WebGL capability to disable. Possible values:</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>Deactivates blending of the computed fragment color values. See {{domxref("WebGLRenderingContext.blendFunc()")}}.</td>
+ </tr>
+ <tr>
+ <td><code>gl.CULL_FACE</code></td>
+ <td>Deactivates culling of polygons. See {{domxref("WebGLRenderingContext.cullFace()")}}.</td>
+ </tr>
+ <tr>
+ <td><code>gl.DEPTH_TEST</code></td>
+ <td>Deactivates depth comparisons and updates to the depth buffer. See {{domxref("WebGLRenderingContext.depthFunc()")}}.</td>
+ </tr>
+ <tr>
+ <td><code>gl.DITHER</code></td>
+ <td>Deactivates dithering of color components before they get written to the color buffer.</td>
+ </tr>
+ <tr>
+ <td><code>gl.POLYGON_OFFSET_FILL</code></td>
+ <td>Deactivates 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>Deactivates the computation of a temporary coverage value determined by the alpha value.</td>
+ </tr>
+ <tr>
+ <td><code>gl.SAMPLE_COVERAGE</code></td>
+ <td>Deactivates 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>Deactivates the 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>Deactivates stencil testing and updates to the stencil buffer. See {{domxref("WebGLRenderingContext.stencilFunc()")}}.</td>
+ </tr>
+ </tbody>
+ </table>
+ When using a {{domxref("WebGL2RenderingContext", "WebGL 2 context", "", 1)}}, the following values are available additionally:
+
+ <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>Deactivates that 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="Return_value">Return value</h3>
+
+<p>None.</p>
+
+<h2 id="Examples">Examples</h2>
+
+<pre class="brush: js">gl.disable(gl.DITHER);
+</pre>
+
+<p>To check if a capability is disabled, use the {{domxref("WebGLRenderingContext.isEnabled()")}} method:</p>
+
+<pre class="brush: js">gl.isEnabled(gl.DITHER);
+// false
+</pre>
+
+<h2 id="Specifications">Specifications</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", "disable")}}</td>
+ <td>{{Spec2('WebGL')}}</td>
+ <td>Initial definition for WebGL.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('OpenGL ES 2.0', "glDisable.xml", "glDisable")}}</td>
+ <td>{{Spec2('OpenGL ES 2.0')}}</td>
+ <td>Man page of the (similar) OpenGL ES 2.0 API.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('OpenGL ES 3.0', "glEnable.xhtml", "glDisable")}}</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="Browser_compatibility">Browser compatibility</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.disable")}}</p>
+
+<h2 id="See_also">See also</h2>
+
+<ul>
+ <li>{{domxref("WebGLRenderingContext.enable()")}}</li>
+ <li>{{domxref("WebGLRenderingContext.isEnabled()")}}</li>
+</ul>