1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
|
---
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>{{Compat("api.WebGLRenderingContext.disable")}}</p>
<h2 id="See_also">See also</h2>
<ul>
<li>{{domxref("WebGLRenderingContext.enable()")}}</li>
<li>{{domxref("WebGLRenderingContext.isEnabled()")}}</li>
</ul>
|