aboutsummaryrefslogtreecommitdiff
path: root/files/ru/web/api/webglrenderingcontext/enable/index.html
blob: d7cc40db94556efa4f3da35dffe5f1614f6eac02 (plain)
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
138
139
---
title: WebGLRenderingContext.enable()
slug: Web/API/WebGLRenderingContext/enable
translation_of: Web/API/WebGLRenderingContext/enable
---
<div>{{APIRef("WebGL")}}</div>

<p>Метод <strong><code>WebGLRenderingContext.enable()</code></strong> из <a href="/en-US/docs/Web/API/WebGL_API">WebGL API</a> активирует определенные возможности WebGL для текущего контекста.</p>

<h2 id="Синтаксис">Синтаксис</h2>

<pre class="syntaxbox">void <var>gl</var>.enable(<var>cap</var>);
</pre>

<h3 id="Параметры">Параметры</h3>

<dl>
 <dt><code>cap</code></dt>
 <dd>A {{domxref("GLenum")}} specifying which WebGL capability to enable. Possible values:</dd>
 <dd>
 <table class="standard-table">
  <thead>
   <tr>
    <th scope="col">Константа</th>
    <th scope="col">Описание</th>
   </tr>
  </thead>
  <tbody>
   <tr>
    <td><code>gl.BLEND</code></td>
    <td>Активирует с<span class="short_text" id="result_box" lang="ru"><span>мешение значений цветов вычисленного фрагмента</span></span>. Смотри {{domxref("WebGLRenderingContext.blendFunc()")}}.</td>
   </tr>
   <tr>
    <td><code>gl.CULL_FACE</code></td>
    <td>Активирует отбраковку полигонов. Смотри {{domxref("WebGLRenderingContext.cullFace()")}}.</td>
   </tr>
   <tr>
    <td><code>gl.DEPTH_TEST</code></td>
    <td>Активирует сравнения глубин и обновления для буфера глубины. Смотри {{domxref("WebGLRenderingContext.depthFunc()")}}.</td>
   </tr>
   <tr>
    <td><code>gl.DITHER</code></td>
    <td>Activates dithering of color components before they get written to the color buffer.</td>
   </tr>
   <tr>
    <td><code>gl.POLYGON_OFFSET_FILL</code></td>
    <td>Activates 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>Activates the computation of a temporary coverage value determined by the alpha value.</td>
   </tr>
   <tr>
    <td><code>gl.SAMPLE_COVERAGE</code></td>
    <td>Activates 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>Activates 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>Activates 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>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.enable(gl.DITHER);
</pre>

<p>To check if a capability is enabled, use the {{domxref("WebGLRenderingContext.isEnabled()")}} method:</p>

<pre class="brush: js">gl.isEnabled(gl.DITHER);
// true
</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", "enable")}}</td>
   <td>{{Spec2('WebGL')}}</td>
   <td>Initial definition for WebGL.</td>
  </tr>
  <tr>
   <td>{{SpecName('OpenGL ES 2.0', "glEnable.xml", "glEnable")}}</td>
   <td>{{Spec2('OpenGL ES 2.0')}}</td>
   <td>Man page of the OpenGL ES 2.0 API.</td>
  </tr>
  <tr>
   <td>{{SpecName('OpenGL ES 3.0', "glEnable.xhtml", "glEnable")}}</td>
   <td>{{Spec2('OpenGL ES 3.0')}}</td>
   <td>Man page of the 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.enable")}}</p>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{domxref("WebGLRenderingContext.disable()")}}</li>
 <li>{{domxref("WebGLRenderingContext.isEnabled()")}}</li>
</ul>