Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(167)

Side by Side Diff: third_party/webgl/specs/r13869/index.html

Issue 9360034: Remove everthing except conformance tests in the deps/third_party/webgl (Closed) Base URL: svn://chrome-svn/chrome/trunk/deps/
Patch Set: Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « third_party/webgl/specs/latest/webgl.idl ('k') | third_party/webgl/specs/r13869/webgl.idl » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
3 <html lang="en">
4 <head>
5 <meta http-equiv="content-type" content="text/html; charset=utf-8">
6 <title>WebGL Specification</title>
7 <meta name="generator" content="BBEdit 9.1">
8 <link rel="stylesheet" type="text/css" href="../../resources/Khronos-WD.css" />
9 <link rel="stylesheet" type="text/css" href="../../resources/default.css" />
10 <script src="../../resources/jquery-1.3.2.min.js" type="text/javascript"></s cript>
11 <script src="../../resources/generateTOC.js" type="text/javascript"></script >
12 </head>
13 <body onload="generateTOC(document.getElementById('toc'))">
14 <!--begin-logo-->
15 <div class=head>
16 <p>
17 <a href="http://khronos.org/">
18 <img alt=Khronos height=60 src="../../resources/KhronosGroup-3D. png" width=220>
19 </a>
20 </p>
21 </div>
22 <div class=head>
23 <p>
24 <a href="http://webgl.org/">
25 <img alt=WebGL height=72 src="../../resources/WebGL-Logo.png" wi dth=156>
26 </a>
27 </p>
28 </div>
29 <!--end-logo-->
30
31 <h1>WebGL Specification</h1>
32 <h2 class="no-toc">Version 1.0, 10 February 2011</h2>
33 <dl>
34 <dt>This version:
35 <dd>
36 <a href="https://www.khronos.org/registry/webgl/specs/latest/">
37 https://www.khronos.org/registry/webgl/specs/latest/
38 </a>
39 <br>
40 <a href="https://www.khronos.org/registry/webgl/specs/latest/web gl.idl">
41 <b>WebIDL:</b> https://www.khronos.org/registry/webgl/specs/ latest/webgl.idl
42 </a>
43 </dd>
44 <dt>Latest version:
45 <dd>
46 <a href="https://www.khronos.org/registry/webgl/specs/latest/">
47 https://www.khronos.org/registry/webgl/specs/latest/
48 </a>
49 <br>
50 <a href="https://www.khronos.org/registry/webgl/specs/latest/web gl.idl">
51 <b>WebIDL:</b> https://www.khronos.org/registry/webgl/specs/ latest/webgl.idl
52 </a>
53 </dd>
54 <dt>Previous version:
55 <dd>
56 none
57 </dd>
58 <dt>Editor:
59 <dd>
60 <a href="mailto:cmarrin@apple.com">Chris Marrin</a>
61 <a href="http://www.apple.com/">(Apple Inc.)</a>
62 </dd>
63 </dl>
64
65 <span style="font-size: x-small; font-style: oblique">Copyright &copy; 2010 Khronos Group</span>
66
67 <hr />
68
69 <h2 class="no-toc">Abstract</h2>
70 <p>
71 This specification describes an additional rendering context and support
72 objects for the
73 <a href="http://www.w3.org/TR/html5/the-canvas-element.html"
74 title="HTML 5 Canvas Element">
75 HTML 5 <span class="prop-name">canvas</span> element <a href="#refsC ANVAS">[CANVAS]</a>.
76 </a>
77 This context allows rendering using an API that conforms closely to the OpenGL ES 2.0 API.
78 </p>
79
80 <h2 class="no-toc">Status of this document</h2>
81
82 <!--begin-status-->
83 <p>
84 Public discussion of this specification
85 is welcome on the (<a
86 href="https://www.khronos.org/webgl/public-mailing-list/archives/">a rchived</a>)
87 WebGL mailing list <a href="mailto:public_webgl@khronos.org">public_webg l@khronos.org</a> (see
88 <a href="http://www.khronos.org/webgl/public-mailing-list/">instructions </a>).
89 </p>
90 <!--end-status-->
91
92 <h2 class="no-toc">Table of contents</h2>
93 <div id="toc"></div>
94
95 <h2>Introduction</h2>
96 <div class="note">
97 <p>
98 WebGLâ„¢ is an immediate mode 3D rendering API designed for the
99 web. It is derived from OpenGL® ES 2.0, and provides similar
100 rendering functionality, but in an HTML context. WebGL is
101 designed as a rendering context for the HTML Canvas element.
102 The HTML Canvas provides a destination for programmatic
103 rendering in web pages, and allows for performing that rendering
104 using different rendering APIs. The only such interface
105 described as part of the Canvas specification is the 2D canvas
106 rendering context, CanvasRenderingContext2D. This document
107 describes another such interface, WebGLRenderingContext, which
108 presents the WebGL API.
109 </p>
110
111 <p>
112 The immediate mode nature of the API is a divergence from most
113 web APIs. Given the many use cases of 3D graphics, WebGL
114 chooses the approach of providing flexible primitives that can
115 be applied to any use case. Libraries can provide an API on top
116 of WebGL that is more tailored to specific areas, thus adding a
117 convenience layer to WebGL that can accelerate and simplify development.
118 However, because of its OpenGL ES 2.0 heritage, it should be
119 straightforward for developers familiar with modern desktop
120 OpenGL or OpenGL ES 2.0 development to transition to WebGL
121 development.
122 </p>
123
124 <p>
125 Many functions described in this document contain links to OpenGL ES
126 man pages. While every effort is made to make these pages match the
127 OpenGL ES 2.0 specification <a href="#refsGLES20">[GLES20]</a>,
128 they may contain errors. In the case of a contradiction, the OpenGL
129 ES 2.0 specification is the final authority.
130 </p>
131
132 <p>
133 The remaining sections of this document are intended to be read in conjunc tion
134 with the OpenGL ES 2.0 specification (2.0.24 at the time of this writing, available
135 from the <a href="http://www.khronos.org/registry/gles/">Khronos OpenGL ES API Registry</a>).
136 Unless otherwise specified, the behavior of each method is defined by the
137 OpenGL ES 2.0 specification. This specification may diverge from OpenGL E S 2.0
138 in order to ensure interoperability or security, often defining areas that
139 OpenGL ES 2.0 leaves implementation-defined. These differences are summar ized in the
140 <a href="#webgl_gl_differences">Differences Between WebGL and OpenGL ES 2. 0</a> section.
141 </p>
142 </div>
143
144 <!-- =========================================================================== ============================ -->
145
146 <h2>Context Creation and Drawing Buffer Presentation</h2>
147
148 <p>
149 Before using the WebGL API, the author must obtain a WebGLRenderingConte xt object
150 for a given HTMLCanvasElement as described below. This object is used to manage
151 OpenGL state and render to the drawing buffer, which must also be create d at the time of
152 context creation. The author may supply configuration options for this d rawing buffer, otherwise
153 default values shall be used as specified elsewhere in this document. Th is drawing buffer
154 is presented to the HTML page compositor immediately before an HTML page compositing operation,
155 but only if the drawing buffer has been modified since the last composit ing operation.
156 </p>
157
158 <!-- =========================================================================== ============================ -->
159
160 <h3>The <span class=prop-name><code>canvas</code></span> Element</h3>
161
162 <p>
163 A WebGLRenderingContext object shall be created by calling the <code>get Context()</code>
164 method of a given HTMLCanvasElement <a href="#refsCANVAS">[CANVAS]</a> o bject with the exact string
165 &lsquo;<code class=property>webgl</code>&rsquo;. This string is case se nsitive. When called
166 for the first time, a WebGLRenderingContext object is created and return ed. Also at this
167 time a drawing buffer shall be created. Subsequent calls to <code>getCon text()</code> with
168 the same string shall return the same object.
169 </p>
170 <p>
171 The HTML Canvas specification <a href="#refsCANVAS">[CANVAS]</a>
172 defines the behavior when attempting to fetch two or more
173 incompatible contexts against the same canvas element.
174 </p>
175 <p>
176 A second parameter may be passed to the <code>getContext()</code> method . If passed, this
177 parameter shall be a WebGLContextAttributes object containing configurat ion parameters to be
178 used in creating the drawing buffer.
179 See <a href="#WEBGLCONTEXTATTRIBUTES">WebGLContextAttributes</a> for mor e details.
180 </p>
181 <p>
182 The passed attributes are requests, not requirements. The WebGL implemen tation does not
183 guarantee that they will be obeyed, but should make a best effort to hon or them.
184 Combinations of attributes not supported by the WebGL implementation or graphics hardware
185 shall not cause a failure to create a WebGLRenderingContext. The attribu tes actually used to
186 create the context may be queried by the <code>getContextAttributes()</c ode> method on the
187 WebGLRenderingContext.
188 </p>
189 <p>
190 On subsequent calls to getContext() with the &lsquo;<code class=property >webgl</code>&rsquo;
191 string, the passed WebGLContextAttributes object, if any, shall be ignor ed.
192 <p>
193 </p>
194
195 <!-- =========================================================================== ============================ -->
196
197 <h3><a name="THE_DRAWING_BUFFER">The Drawing Buffer</a></h3>
198
199 <p>
200 The drawing buffer into which the API calls are rendered shall be define d upon creation of
201 the WebGLRenderingContext object. The table below shows all the buffers which make up
202 the drawing buffer, along with their minimum sizes and whether they are defined or not by
203 default. The size of this drawing buffer shall be determined by the <cod e>width</code>
204 and <code>height</code> attributes of the HTMLCanvasElement. The table b elow also shows
205 the value to which these buffers shall be cleared when first created or when the size is
206 changed.
207 </p>
208 <table class="foo">
209 <tr><th>Buffer</th><th>Clear value</th><th>Minimum size</th><th>Defined by default?</th></tr>
210 <tr><td>Color</td><td>(0, 0, 0, 0)</td><td>8 bits per component</td><td> yes</td></tr>
211 <tr><td>Depth</td><td>1.0</td><td>16 bit integer</td><td>yes</td></tr>
212 <tr><td>Stencil</td><td>0</td><td>8 bits</td><td>no</td></tr>
213 </table>
214 <br>
215 <p>
216 If the requested width or height cannot be satisfied, either when the dr awing buffer is first
217 created or when the <code>width</code> and <code>height</code> attribute s of the
218 <code>HTMLCanvasElement</code> are changed, a drawing buffer with smalle r dimensions shall
219 be created. The dimensions actually used are implementation dependent an d there is no
220 guarantee that a buffer with the same aspect ratio will be created. The actual drawing
221 buffer size can be obtained from the <code>drawingBufferWidth</code> and
222 <code>drawingBufferHeight</code> attributes.
223 </p>
224 <p>
225 By default, the buffers shall be the size shown below. The optional <a h ref="#WEBGLCONTEXTATTRIBUTES">WebGLContextAttributes</a>
226 object may be used to change whether or not the buffers are defined. It can also be used
227 to define whether the color buffer will include an alpha channel. If def ined, the
228 alpha channel is used by the HTML compositor to combine the color buffer with the rest
229 of the page. The WebGLContextAttributes object is only used on the first call to
230 <code>getContext</code>. No facility is provided to change the attribute s of the drawing
231 buffer after its creation.
232 </p>
233 <p>
234 WebGL presents its drawing buffer to the HTML page compositor immediatel y before a compositing
235 operation, but only if the drawing buffer has been modified since the la st compositing operation.
236 Before the drawing buffer is presented for compositing the implementatio n shall ensure that all
237 rendering operations have been flushed to the drawing buffer. By default , after compositing the
238 contents of the drawing buffer shall be cleared to their default values, as shown in the table
239 above.
240 </p>
241 <p>
242 This default behavior can be changed by setting the <code>preserveDrawin gBuffer</code>
243 attribute of the <a href="#WEBGLCONTEXTATTRIBUTES">WebGLContextAttribute s</a> object. If
244 this flag is true, the contents of the drawing buffer shall be preserved until the author
245 either clears or overwrites them. If this flag is false, attempting to p erform operations
246 using this context as a source image after the rendering function has re turned can lead to
247 undefined behavior. This includes <code>readPixels</code> or <code>toDat aURL</code> calls,
248 or using this context as the source image of another context's <code>tex Image2D</code> or
249 <code>drawImage</code> call.
250 </p>
251 <div class="note">
252 <p>
253 While it is sometimes desirable to preserve the drawing buffer, it c an cause significant
254 performance loss on some platforms. Whenever possible this flag shou ld remain false
255 and other techniques used. Techniques like synchronous drawing buffe r access (e.g.,
256 calling <code>readPixels</code> or <code>toDataURL</code> in the sam e function that
257 renders to the drawing buffer) can be used to get the contents of th e drawing buffer.
258 If the author needs to render to the same drawing buffer over a seri es of calls, a
259 <a href="#WEBGL_FRAMEBUFFER">Framebuffer Object</a> can be used.
260 </p>
261 <p>
262 Implementations may optimize away the required implicit clear operat ion of the Drawing
263 Buffer as long as a guarantee can be made that the author cannot gai n access to buffer
264 contents from another process. For instance, if the author performs an explicit
265 clear then the implicit clear is not needed.
266 </p>
267 </div>
268
269 <!-- =========================================================================== ============================ -->
270
271 <h3>The WebGL Viewport</h3>
272
273 <p>
274 OpenGL manages a rectangular viewport as part of its state which defines the placement of the
275 rendering results in the drawing buffer. Upon creation of the WebGL cont ext, the viewport is
276 initialized to a rectangle with origin at (0, 0) and width and height eq ual to (canvas.width,
277 canvas.height).
278 </p>
279 <p>
280 A WebGL implementation <em>shall not</em> affect the state of the OpenGL viewport in response to
281 resizing of the canvas element.
282 </p>
283 <div class="example">
284 Note that if a WebGL program does not contain logic to set the viewport, it will not properly
285 handle the case where the canvas is resized. The following ECMAScript ex ample illustrates how
286 a WebGL program might resize the canvas programmatically.
287
288 <pre>
289 var canvas = document.getElementById('canvas1');
290 var gl = canvas.getContext('webgl');
291 canvas.width = newWidth;
292 canvas.height = newHeight;
293 gl.viewport(0, 0, canvas.width, canvas.height);
294 </pre>
295 </div>
296 <p>
297 <em>Rationale</em>: automatically setting the viewport will interfere wi th applications that set
298 it manually. Applications are expected to use <code>onresize</code> hand lers to respond to
299 changes in size of the canvas and set the OpenGL viewport in turn.
300 </p>
301
302 <!-- =========================================================================== ============================ -->
303
304 <h3><a name="PREMULTIPLIED_ALPHA">Premultiplied Alpha, Canvas APIs and texIm age2D</a></h3>
305
306 <p>
307 The OpenGL API allows the application to modify the blending modes used during rendering,
308 and for this reason allows control over how alpha values in the drawing buffer are
309 interpreted; see the <code>premultipliedAlpha</code> parameter in
310 the <a href="#WEBGLCONTEXTATTRIBUTES">WebGLContextAttributes</a> section .
311 </p>
312 <p>
313 The HTML Canvas APIs <code>toDataURL</code> and <code>drawImage</code> m ust respect
314 the <code>premultipliedAlpha</code> context creation parameter. When <co de>toDataURL</code>
315 is called against a Canvas into which WebGL content is being rendered, t hen if the requested
316 image format does not specify premultiplied alpha and the WebGL context has
317 the <code>premultipliedAlpha</code> parameter set to true, then the pixe l values must be
318 de-multiplied; i.e., the color channels are divided by the alpha channel . <b>Note</b> that
319 this operation is lossy.
320 </p>
321 <p>
322 Passing a WebGL-rendered Canvas to the <code>drawImage</code> method
323 of <code>CanvasRenderingContext2D</code> may or may not need to modify t he the rendered
324 WebGL content during the drawing operation, depending on the premultipli cation needs of the
325 <code>CanvasRenderingContext2D</code> implementation.
326 </p>
327 <p>
328 When passing a WebGL-rendered Canvas to the <code>texImage2D</code> API, then depending on
329 the setting of the <code>premultipliedAlpha</code> context creation para meter of the passed
330 canvas and the <code>UNPACK_PREMULTIPLY_ALPHA_WEBGL</code> pixel store p arameter of the
331 destination WebGL context, the pixel data may need to be changed to or f rom premultiplied
332 form.
333 </p>
334
335 <!-- =========================================================================== ============================ -->
336
337 <h2>WebGL Resources</h2>
338
339 <p>
340 OpenGL manages several types of resources as part of its state. These ar e identified
341 by integer object names and are obtained from OpenGL by various creation calls.
342 In contrast WebGL represents these resources as DOM objects. Each object is derived
343 from the WebGLObject interface. Currently supported resources are:
344 textures, buffers (i.e., VBOs), framebuffers, renderbuffers, shaders and
345 programs. The WebGLRenderingContext interface has a method to create a
346 WebGLObject subclass for each type. Data from the underlying graphics li brary are
347 stored in these objects and are fully managed by them. The resources rep resented
348 by these objects are guaranteed to exist as long as the object exists.
349 Furthermore, the DOM object is guaranteed to exist as long as the author has an explicit
350 valid reference to it <b>or</b> as long as it is bound by the underlying graphics library.
351 When none of these conditions exist the user agent can, at any point, de lete the object
352 using the equivalent of a delete call (e.g., deleteTexture). If authors wish to control
353 when the underlying resource is released then the delete call can be mad e explicitly.
354 </p>
355
356 <!-- =========================================================================== ============================ -->
357
358 <h2>Security</h2>
359
360 <p>
361 </p>
362
363 <!-- =========================================================================== ============================ -->
364
365 <h3>Resource Restrictions</h3>
366
367 <p>
368 WebGL resources such as textures and vertex buffer objects (VBOs) must a lways
369 contain initialized data, even if they were created without initial user
370 data values. Creating a resource without initial values is commonly use d to
371 reserve space for a texture or VBO, which is then modified using <code>t exSubImage</code> or
372 <code>bufferSubData</code> calls. If initial data is not provided to th ese calls, the WebGL
373 implementation must initialize their contents to 0; depth renderbuffers must be cleared to
374 the default 1.0 clear depth. For example, this may require creating a t emporary buffer of 0
375 values the size of a requested VBO, so that it can be initialized correc tly. All other
376 forms of loading data into a texture or VBO involve either ArrayBuffers or DOM objects such
377 as images, and are therefore already required to be initialized.
378 </p>
379
380 <p>
381 When WebGL resources are accessed by shaders through a call such as
382 <code>drawElements</code> or <code>drawArrays</code>, the WebGL implemen tation must ensure
383 that the shader cannot access either out of bounds or uninitialized data .
384 See <a href="#ATTRIBS_AND_RANGE_CHECKING">Enabled Vertex Attributes and Range Checking</a>
385 for restrictions which must be enforced by the WebGL implementation.
386 </p>
387
388 <!-- =========================================================================== ============================ -->
389
390 <h3>Origin Restrictions</h3>
391
392 <p>
393 In order to prevent information leakage, the HTML5 canvas element has
394 a <i>origin-clean</i> flag. (See HTML5, section 4.8.11.3, "Security wit h canvas
395 elements".) For a WebGL context, the <i>origin-clean</i> flag must be s et to false
396 if any of the following actions occur:
397 </p>
398 <ul>
399 <li>The <code>texImage2D</code> method is called with an <code>HTMLI mageElement</code> or
400 <code>HTMLVideoElement</code> whose origin is not the same as th at of the Document
401 object that owns the canvas element.
402 <li>The <code>texImage2D</code> method is called with an <code>HTMLC anvasElement</code>
403 whose <i>origin-clean</i> flag is set to false.
404 </ul>
405 <p>
406 Whenever the <code>readPixels</code> method of the 2D context of a <code >canvas</code>
407 element whose <i>origin-clean</i> flag is set to false is called with ot herwise correct
408 arguments, the method must raise a <code>SECURITY_ERR</code> exception.
409 </p>
410
411 <!-- =========================================================================== ============================ -->
412
413 <h3><a name="SUPPORTED_GLSL_CONSTRUCTS">Supported GLSL Constructs</a></h3>
414
415 <p>
416 A WebGL implementation must only accept shaders which conform to The Ope nGL ES Shading
417 Language, Version 1.00 <a href="#refsGLES20GLSL">[GLES20GLSL]</a>, and w hich do not exceed
418 the minimum functionality mandated in Sections 4 and 5 of Appendix A. I n particular, a shader
419 referencing state variables or functions that are available in other ver sions of GLSL (such
420 as that found in versions of OpenGL for the desktop), must not be allowe d to load.
421 </p>
422 <p>
423 In addition to the reserved identifiers in the aforementioned specificat ion, identifiers
424 starting with "webgl_" and "_webgl_" are reserved for use by WebGL. A sh ader which declares
425 a function, variable, structure name, or structure field starting with t hese prefixes must
426 not be allowed to load.
427 </p>
428
429 <!-- =========================================================================== ============================ -->
430
431 <h3>Defense Against Denial of Service</h3>
432 <div class="note">
433 <p>
434 It is possible to create, either intentionally or unintentionally, combinati ons of shaders and
435 geometry that take an undesirably long time to render. This issue is analogo us to that of
436 long-running scripts, for which user agents already have safeguards. However , long-running draw
437 calls can cause loss of interactivity for the entire window system, not just the user agent.
438 </p>
439
440 <p>
441 In the general case it is not possible to impose limits on the structure of incoming shaders to
442 guard against this problem. Experimentation has shown that even very strict structural limits
443 are insufficient to prevent long rendering times, and such limits would prev ent shader authors
444 from implementing common algorithms.
445 </p>
446
447 <p>
448 User agents should implement safeguards to prevent excessively long renderin g times and
449 associated loss of interactivity. Suggested safeguards include:
450 </p>
451
452 <ul>
453
454 <li> Splitting up draw calls with large numbers of elements into smaller dra w calls.
455
456 <li> Timing individual draw calls and forbidding further rendering from a pa ge if a certain
457 timeout is exceeded.
458
459 <li> Using any watchdog facilities available at the user level, graphics API level, or operating
460 system level to limit the duration of draw calls.
461
462 <li> Separating the graphics rendering of the user agent into a distinct ope rating system
463 process which can be terminated and restarted without losing applicatio n state.
464
465 </ul>
466
467 <p>
468 The supporting infrastructure at the OS and graphics API layer is expected t o improve over time,
469 which is why the exact nature of these safeguards is not specified.
470 </p>
471 </div>
472 <!-- =========================================================================== ============================ -->
473
474 <h2>DOM Interfaces</h2>
475
476 <p>
477 This section describes the interfaces and functionality added to the
478 DOM to support runtime access to the functionality described above.
479 </p>
480
481 <!-- =========================================================================== ============================ -->
482
483 <h3>Types</h3>
484
485 <p>
486 The following types are used in all interfaces in the following section.
487 </p>
488 <pre class="idl">
489 typedef events::Event Event;
490 typedef html::HTMLCanvasElement HTMLCanvasElement;
491 typedef html::HTMLImageElement HTMLImageElement;
492 typedef html::HTMLVideoElement HTMLVideoElement;
493 typedef html::ImageData ImageData;
494
495 typedef unsigned long GLenum;
496 typedef boolean GLboolean;
497 typedef unsigned long GLbitfield;
498 typedef byte GLbyte; /* 'byte' should be a signed 8 bit type. */
499 typedef short GLshort;
500 typedef long GLint;
501 typedef long GLsizei;
502 typedef long long GLintptr;
503 typedef long long GLsizeiptr;
504 typedef unsigned byte GLubyte; /* 'unsigned byte' should be an unsigned 8 bit type. */
505 typedef unsigned short GLushort;
506 typedef unsigned long GLuint;
507 typedef float GLfloat;
508 typedef float GLclampf;
509 </pre>
510
511 <!-- =========================================================================== ============================ -->
512
513 <h3><a name="WEBGLCONTEXTATTRIBUTES">WebGLContextAttributes</a></h3>
514
515 <p>
516 The <code>WebGLContextAttributes</code> interface contains drawing surfa ce attributes and is
517 passed as the second parameter to <code>getContext</code>. A native obje ct may be supplied
518 as this parameter; the specified attributes will be queried from this ob ject.
519 </p>
520 <pre class="idl">[Callback] interface <dfn id="WebGLContextAttributes">WebGL ContextAttributes</dfn> {
521 attribute boolean alpha;
522 attribute boolean depth;
523 attribute boolean stencil;
524 attribute boolean antialias;
525 attribute boolean premultipliedAlpha;
526 attribute boolean preserveDrawingBuffer;
527 };</pre>
528
529 <h4>Context creation parameters</h4>
530
531 <p>
532 The following list describes each attribute in the WebGLContextAttribute s object and its
533 use. For each attribute the default value is shown. The default value is used either if no
534 second parameter is passed to <code>getContext</code>, or if a native ob ject is passed which
535 has no attribute of the given name.
536 </p>
537 <dl>
538 <dt><span class=prop-value>alpha</span></dt>
539 <dd>
540 <em>Default: true</em>. If the value is true, the drawing buffer has an alpha
541 channel for the purposes of performing OpenGL destination alpha operations and
542 compositing with the page. If the value is false, no alpha buffe r is available.
543 </dd>
544 <dt> <span class=prop-value>depth</span>
545 <dd>
546 <em>Default: true</em>. If the value is true, the drawing buffer has a depth
547 buffer of at least 16 bits. If the value is false, no depth buff er is
548 available.
549 </dd>
550 <dt> <span class=prop-value>stencil</span>
551 <dd>
552 <em>Default: false</em>. If the value is true, the drawing buffe r has a stencil
553 buffer of at least 8 bits. If the value is false, no stencil buf fer is
554 available.
555 </dd>
556 <dt> <span class=prop-value>antialias</span>
557 <dd>
558 <em>Default: true</em>. If the value is true and the implementat ion supports
559 antialiasing the drawing buffer will perform antialiasing using its choice of
560 technique (multisample/supersample) and quality. If the value is false or the
561 implementation does not support antialiasing, no antialiasing is performed.
562 </dd>
563 <dt> <span class=prop-value>premultipliedAlpha</span>
564 <dd>
565 <em>Default: true</em>. If the value is true the page compositor will assume the
566 drawing buffer contains colors with premultiplied alpha. If the value is false the
567 page compositor will assume that colors in the drawing buffer ar e not
568 premultiplied. This flag is ignored if the <strong>alpha</strong > flag is
569 false. See <a href="#PREMULTIPLIED_ALPHA">Premultiplied Alpha</a > for more
570 information on the effects of the <code>premultipliedAlpha</code > flag.
571 </dd>
572 <dt> <span class=prop-value>preserveDrawingBuffer</span>
573 <dd>
574 <em>Default: false</em>. If false, once the drawing buffer is pr esented
575 as described in the<a href="#THE_DRAWING_BUFFER">Drawing Buffer< /a> section,
576 the contents of the drawing buffer are cleared to their default values.
577 All elements of the drawing buffer (color, depth and stencil) ar e cleared.
578 If the value is true the buffers will not be cleared and will pr eserve
579 their values until cleared or overwritten by the author.
580 <blockquote>
581 <em>
582 On some hardware setting the <code>preserveDrawingBuffer</co de> flag
583 to true can have significant performance implications.
584 </em>
585 </blockquote>
586 </dd>
587 </dl>
588 <div class="example">
589 Here is an ECMAScript example which passes a WebGLContextAttributes argument
590 to <code>getContext</code>. It assumes the presence of a canvas element nam ed "canvas1" on the
591 page.
592
593 <pre>
594 var canvas = document.getElementById('canvas1');
595 var context = canvas.getContext('webgl',
596 { antialias: false,
597 stencil: true });
598 </pre>
599 </div>
600
601 <!-- =========================================================================== ============================ -->
602
603 <h3>WebGLObject</h3>
604
605 <p>
606 The <code>WebGLObject</code> interface is the parent interface for all G L objects.
607 </p>
608 <pre class="idl">interface <dfn id="WebGLObject">WebGLObject</dfn> {
609 };</pre>
610
611 <!-- =========================================================================== ============================ -->
612
613 <h3>WebGLBuffer</h3>
614
615 <p>
616 The <code>WebGLBuffer</code> interface represents an OpenGL Buffer Objec t. The
617 underlying object is created as if by calling glGenBuffers
618 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.9">OpenGL ES 2.0 &sect;2.9</a >, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/docs/ma n/glGenBuffers.xml">man page</a>)</span>
619 , bound as if by calling glBindBuffer
620 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.9">OpenGL ES 2.0 &sect;2.9</a >, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/docs/ma n/glBindBuffer.xml">man page</a>)</span>
621 and destroyed as if by calling glDeleteBuffers
622 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.9">OpenGL ES 2.0 &sect;2.9</a >, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/docs/ma n/glDeleteBuffers.xml">man page</a>)</span>
623 .
624 </p>
625 <pre class="idl">interface <dfn id="WebGLBuffer">WebGLBuffer</dfn> : WebGLOb ject {
626 };</pre>
627
628 <!-- =========================================================================== ============================ -->
629
630 <h3><a name="WEBGL_FRAMEBUFFER">WebGLFramebuffer</a></h3>
631
632 <p>
633 The <code>WebGLFramebuffer</code> interface represents an OpenGL Framebu ffer Object. The
634 underlying object is created as if by calling glGenFramebuffers
635 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.1">OpenGL ES 2.0 &sect;4.4. 1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glGenFramebuffers.xml">man page</a>)</span>
636 , bound as if by calling glBindFramebuffer
637 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.1">OpenGL ES 2.0 &sect;4.4. 1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glBindFramebuffer.xml">man page</a>)</span>
638 and destroyed as if by calling glDeleteFramebuffers
639 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.1">OpenGL ES 2.0 &sect;4.4. 1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glDeleteFramebuffers.xml">man page</a>)</span>
640 .
641 </p>
642 <pre class="idl">interface <dfn id="WebGLFramebuffer">WebGLFramebuffer</dfn> : WebGLObject {
643 };</pre>
644
645 <!-- =========================================================================== ============================ -->
646
647 <h3>WebGLProgram</h3>
648
649 <p>
650 The <code>WebGLProgram</code> interface represents an OpenGL Program Obj ect. The
651 underlying object is created as if by calling glCreateProgram
652 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.3">OpenGL ES 2.0 &sect;2.1 0.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/d ocs/man/glCreateProgram.xml">man page</a>)</span>
653 , used as if by calling glUseProgram
654 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.3">OpenGL ES 2.0 &sect;2.1 0.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/d ocs/man/glUseProgram.xml">man page</a>)</span>
655 and destroyed as if by calling glDeleteProgram
656 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.3">OpenGL ES 2.0 &sect;2.1 0.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/d ocs/man/glDeleteProgram.xml">man page</a>)</span>
657 .
658 </p>
659 <pre class="idl">interface <dfn id="WebGLProgram">WebGLProgram</dfn> : WebGL Object {
660 };</pre>
661
662 <!-- =========================================================================== ============================ -->
663
664 <h3>WebGLRenderbuffer</h3>
665
666 <p>
667 The <code>WebGLRenderbuffer</code> interface represents an OpenGL Render buffer Object. The
668 underlying object is created as if by calling glGenRenderbuffers
669 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.3">OpenGL ES 2.0 &sect;4.4. 3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glGenRenderbuffers.xml">man page</a>)</span>
670 , bound as if by calling glBindRenderbuffer
671 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.3">OpenGL ES 2.0 &sect;4.4. 3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glBindRenderbuffer.xml">man page</a>)</span>
672 and destroyed as if by calling glDeleteRenderbuffers
673 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.3">OpenGL ES 2.0 &sect;4.4. 3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glDeleteRenderbuffers.xml">man page</a>)</span>
674 .
675 </p>
676 <pre class="idl">interface <dfn id="WebGLRenderbuffer">WebGLRenderbuffer</df n> : WebGLObject {
677 };</pre>
678
679 <!-- =========================================================================== ============================ -->
680
681 <h3>WebGLShader</h3>
682
683 <p>
684 The <code>WebGLShader</code> interface represents an OpenGL Shader Objec t. The
685 underlying object is created as if by calling glCreateShader
686 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.1">OpenGL ES 2.0 &sect;2.1 0.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/d ocs/man/glCreateShader.xml">man page</a>)</span>
687 , attached to a Program as if by calling glAttachShader
688 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.3">OpenGL ES 2.0 &sect;2.1 0.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/d ocs/man/glAttachShader.xml">man page</a>)</span>
689 and destroyed as if by calling glDeleteShader
690 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.1">OpenGL ES 2.0 &sect;2.1 0.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/d ocs/man/glDeleteShader.xml">man page</a>)</span>
691 .
692 </p>
693 <pre class="idl">interface <dfn id="WebGLShader">WebGLShader</dfn> : WebGLOb ject {
694 };</pre>
695
696 <!-- =========================================================================== ============================ -->
697
698 <h3>WebGLTexture</h3>
699
700 <p>
701 The <code>WebGLTexture</code> interface represents an OpenGL Texture Obj ect. The
702 underlying object is created as if by calling glGenTextures
703 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.13">OpenGL ES 2.0 &sect;3.7 .13</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/d ocs/man/glGenTextures.xml">man page</a>)</span>
704 , bound as if by calling glBindTexture
705 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.13">OpenGL ES 2.0 &sect;3.7 .13</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/d ocs/man/glBindTexture.xml">man page</a>)</span>
706 and destroyed as if by calling glDeleteTextures
707 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/spe cs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.13">OpenGL ES 2.0 &sect;3.7 .13</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/d ocs/man/glDeleteTextures.xml">man page</a>)</span>
708 .
709 </p>
710 <pre class="idl">interface <dfn id="WebGLTexture">WebGLTexture</dfn> : WebGL Object {
711 };</pre>
712
713 <!-- =========================================================================== ============================ -->
714
715 <h3>WebGLUniformLocation</h3>
716
717 <p>
718 The <code>WebGLUniformLocation</code> interface represents the location of a uniform variable
719 in a shader program.
720 </p>
721 <pre class="idl">interface <dfn id="WebGLUniformLocation">WebGLUniformLocati on</dfn> {
722 };</pre>
723
724 <!-- =========================================================================== ============================ -->
725
726 <h3>WebGLActiveInfo</h3>
727
728 <p>
729 The <code>WebGLActiveInfo</code> interface represents the information re turned
730 from the getActiveAttrib and getActiveUniform calls.
731 </p>
732 <pre class="idl">interface <dfn id="WebGLActiveInfo">WebGLActiveInfo</dfn> {
733 readonly attribute GLint size;
734 readonly attribute GLenum type;
735 readonly attribute DOMString name;
736 };</pre>
737
738 <h4>Attributes</h4>
739
740 <p>
741 The following attributes are available:
742 </p>
743
744 <dl class="methods">
745 <dt>
746 <code class=attribute-name>
747 <a id="DOM-WebGLActiveInfo-size">
748 size
749 </a>
750 </code>
751 of type <code>GLint</code>
752 <dd>
753 The size of the requested variable.
754 <dt>
755 <code class=attribute-name>
756 <a id="DOM-WebGLActiveInfo-type">
757 type
758 </a>
759 </code>
760 of type <code>GLenum</code>
761 <dd>
762 The data type of the requested variable.
763 <dt>
764 <code class=attribute-name>
765 <a id="DOM-WebGLActiveInfo-name">
766 name
767 </a>
768 </code>
769 of type <code>DOMString</code>
770 <dd>
771 The name of the requested variable.
772 </dl>
773
774 <!-- =========================================================================== ============================ -->
775
776 <h3><a name="ARRAYBUFFER">ArrayBuffer</a> and <a name="TYPEDARRAY">Typed Arr ays</a></h3>
777
778 <p>
779 Vertex, index, texture, and other data is transferred to the WebGL imple mentation using
780 the <a href="../../../typedarray/specs/latest/#ARRAYBUFFER">ArrayBuffer< /a>
781 and <a href="../../../typedarray/specs/latest/#TYPEDARRAYS">views</a> de fined in
782 the <a href="../../../typedarray/specs/latest/">Typed Array</a>
783 specification <a href="#refsTYPEDARRAYS">[TYPEDARRAYS]</a>. All of the t yped array views
784 except <tt>Float64Array</tt> may be used in conjunction with WebGL; Open GL ES 2.0, and
785 therefore WebGL, does not support double-precision floating-point data.
786 </p>
787 <p>
788 Typed Arrays support the creation of interleaved, heterogeneous vertex d ata; uploading of
789 distinct blocks of data into a large vertex buffer object; and most othe r use cases required
790 by OpenGL programs.
791 </p>
792
793 <div class="example">
794 Here is an ECMAScript example showing access to the same ArrayBuffer using d ifferent types of
795 typed arrays. In this case the buffer contains a floating point vertex posit ion (x, y, z)
796 followed by a color as 4 unsigned bytes (r, g, b, a).
797
798 <pre>
799 var numVertices = 100; // for example
800
801 // Compute the size needed for the buffer, in bytes and floats
802 var vertexSize = 3 * Float32Array.BYTES_PER_ELEMENT +
803 4 * Uint8Array.BYTES_PER_ELEMENT;
804 var vertexSizeInFloats = vertexSize / Float32Array.BYTES_PER_ELEMENT;
805
806 // Allocate the buffer
807 var buf = new ArrayBuffer(numVertices * vertexSize);
808
809 // Map this buffer to a Float32Array to access the positions
810 var positionArray = new Float32Array(buf);
811
812 // Map the same buffer to a Uint8Array to access the color
813 var colorArray = new Uint8Array(buf);
814
815 // Set up the initial offset of the vertices and colors within the buffer
816 var positionIdx = 0;
817 var colorIdx = 3 * Float32Array.BYTES_PER_ELEMENT;
818
819 // Initialize the buffer
820 for (var i = 0; i < numVertices; i++) {
821 positionArray[positionIdx] = ...;
822 positionArray[positionIdx + 1] = ...;
823 positionArray[positionIdx + 2] = ...;
824 colorArray[colorIdx] = ...;
825 colorArray[colorIdx + 1] = ...;
826 colorArray[colorIdx + 2] = ...;
827 colorArray[colorIdx + 3] = ...;
828 positionIdx += vertexSizeInFloats;
829 colorIdx += vertexSize;
830 }
831 </pre>
832 </div>
833
834 <!-- =========================================================================== ============================ -->
835
836 <h3><a name="WEBGLRENDERINGCONTEXT">The WebGL context</a></h3>
837
838 <p>
839 The <code>WebGLRenderingContext</code> represents the API allowing
840 OpenGL ES 2.0 style rendering into the canvas element.
841 </p>
842 <pre class="idl">interface <dfn id="WebGLRenderingContext">WebGLRenderingCon text</dfn> {
843
844 /* ClearBufferMask */
845 const GLenum DEPTH_BUFFER_BIT = 0x00000100;
846 const GLenum STENCIL_BUFFER_BIT = 0x00000400;
847 const GLenum COLOR_BUFFER_BIT = 0x00004000;
848
849 /* BeginMode */
850 const GLenum POINTS = 0x0000;
851 const GLenum LINES = 0x0001;
852 const GLenum LINE_LOOP = 0x0002;
853 const GLenum LINE_STRIP = 0x0003;
854 const GLenum TRIANGLES = 0x0004;
855 const GLenum TRIANGLE_STRIP = 0x0005;
856 const GLenum TRIANGLE_FAN = 0x0006;
857
858 /* AlphaFunction (not supported in ES20) */
859 /* NEVER */
860 /* LESS */
861 /* EQUAL */
862 /* LEQUAL */
863 /* GREATER */
864 /* NOTEQUAL */
865 /* GEQUAL */
866 /* ALWAYS */
867
868 /* BlendingFactorDest */
869 const GLenum ZERO = 0;
870 const GLenum ONE = 1;
871 const GLenum SRC_COLOR = 0x0300;
872 const GLenum ONE_MINUS_SRC_COLOR = 0x0301;
873 const GLenum SRC_ALPHA = 0x0302;
874 const GLenum ONE_MINUS_SRC_ALPHA = 0x0303;
875 const GLenum DST_ALPHA = 0x0304;
876 const GLenum ONE_MINUS_DST_ALPHA = 0x0305;
877
878 /* BlendingFactorSrc */
879 /* ZERO */
880 /* ONE */
881 const GLenum DST_COLOR = 0x0306;
882 const GLenum ONE_MINUS_DST_COLOR = 0x0307;
883 const GLenum SRC_ALPHA_SATURATE = 0x0308;
884 /* SRC_ALPHA */
885 /* ONE_MINUS_SRC_ALPHA */
886 /* DST_ALPHA */
887 /* ONE_MINUS_DST_ALPHA */
888
889 /* BlendEquationSeparate */
890 const GLenum FUNC_ADD = 0x8006;
891 const GLenum BLEND_EQUATION = 0x8009;
892 const GLenum BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQU ATION */
893 const GLenum BLEND_EQUATION_ALPHA = 0x883D;
894
895 /* BlendSubtract */
896 const GLenum FUNC_SUBTRACT = 0x800A;
897 const GLenum FUNC_REVERSE_SUBTRACT = 0x800B;
898
899 /* Separate Blend Functions */
900 const GLenum BLEND_DST_RGB = 0x80C8;
901 const GLenum BLEND_SRC_RGB = 0x80C9;
902 const GLenum BLEND_DST_ALPHA = 0x80CA;
903 const GLenum BLEND_SRC_ALPHA = 0x80CB;
904 const GLenum CONSTANT_COLOR = 0x8001;
905 const GLenum ONE_MINUS_CONSTANT_COLOR = 0x8002;
906 const GLenum CONSTANT_ALPHA = 0x8003;
907 const GLenum ONE_MINUS_CONSTANT_ALPHA = 0x8004;
908 const GLenum BLEND_COLOR = 0x8005;
909
910 /* Buffer Objects */
911 const GLenum ARRAY_BUFFER = 0x8892;
912 const GLenum ELEMENT_ARRAY_BUFFER = 0x8893;
913 const GLenum ARRAY_BUFFER_BINDING = 0x8894;
914 const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
915
916 const GLenum STREAM_DRAW = 0x88E0;
917 const GLenum STATIC_DRAW = 0x88E4;
918 const GLenum DYNAMIC_DRAW = 0x88E8;
919
920 const GLenum BUFFER_SIZE = 0x8764;
921 const GLenum BUFFER_USAGE = 0x8765;
922
923 const GLenum CURRENT_VERTEX_ATTRIB = 0x8626;
924
925 /* CullFaceMode */
926 const GLenum FRONT = 0x0404;
927 const GLenum BACK = 0x0405;
928 const GLenum FRONT_AND_BACK = 0x0408;
929
930 /* DepthFunction */
931 /* NEVER */
932 /* LESS */
933 /* EQUAL */
934 /* LEQUAL */
935 /* GREATER */
936 /* NOTEQUAL */
937 /* GEQUAL */
938 /* ALWAYS */
939
940 /* EnableCap */
941 /* TEXTURE_2D */
942 const GLenum CULL_FACE = 0x0B44;
943 const GLenum BLEND = 0x0BE2;
944 const GLenum DITHER = 0x0BD0;
945 const GLenum STENCIL_TEST = 0x0B90;
946 const GLenum DEPTH_TEST = 0x0B71;
947 const GLenum SCISSOR_TEST = 0x0C11;
948 const GLenum POLYGON_OFFSET_FILL = 0x8037;
949 const GLenum SAMPLE_ALPHA_TO_COVERAGE = 0x809E;
950 const GLenum SAMPLE_COVERAGE = 0x80A0;
951
952 /* ErrorCode */
953 const GLenum NO_ERROR = 0;
954 const GLenum INVALID_ENUM = 0x0500;
955 const GLenum INVALID_VALUE = 0x0501;
956 const GLenum INVALID_OPERATION = 0x0502;
957 const GLenum OUT_OF_MEMORY = 0x0505;
958
959 /* FrontFaceDirection */
960 const GLenum CW = 0x0900;
961 const GLenum CCW = 0x0901;
962
963 /* GetPName */
964 const GLenum LINE_WIDTH = 0x0B21;
965 const GLenum ALIASED_POINT_SIZE_RANGE = 0x846D;
966 const GLenum ALIASED_LINE_WIDTH_RANGE = 0x846E;
967 const GLenum CULL_FACE_MODE = 0x0B45;
968 const GLenum FRONT_FACE = 0x0B46;
969 const GLenum DEPTH_RANGE = 0x0B70;
970 const GLenum DEPTH_WRITEMASK = 0x0B72;
971 const GLenum DEPTH_CLEAR_VALUE = 0x0B73;
972 const GLenum DEPTH_FUNC = 0x0B74;
973 const GLenum STENCIL_CLEAR_VALUE = 0x0B91;
974 const GLenum STENCIL_FUNC = 0x0B92;
975 const GLenum STENCIL_FAIL = 0x0B94;
976 const GLenum STENCIL_PASS_DEPTH_FAIL = 0x0B95;
977 const GLenum STENCIL_PASS_DEPTH_PASS = 0x0B96;
978 const GLenum STENCIL_REF = 0x0B97;
979 const GLenum STENCIL_VALUE_MASK = 0x0B93;
980 const GLenum STENCIL_WRITEMASK = 0x0B98;
981 const GLenum STENCIL_BACK_FUNC = 0x8800;
982 const GLenum STENCIL_BACK_FAIL = 0x8801;
983 const GLenum STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802;
984 const GLenum STENCIL_BACK_PASS_DEPTH_PASS = 0x8803;
985 const GLenum STENCIL_BACK_REF = 0x8CA3;
986 const GLenum STENCIL_BACK_VALUE_MASK = 0x8CA4;
987 const GLenum STENCIL_BACK_WRITEMASK = 0x8CA5;
988 const GLenum VIEWPORT = 0x0BA2;
989 const GLenum SCISSOR_BOX = 0x0C10;
990 /* SCISSOR_TEST */
991 const GLenum COLOR_CLEAR_VALUE = 0x0C22;
992 const GLenum COLOR_WRITEMASK = 0x0C23;
993 const GLenum UNPACK_ALIGNMENT = 0x0CF5;
994 const GLenum PACK_ALIGNMENT = 0x0D05;
995 const GLenum MAX_TEXTURE_SIZE = 0x0D33;
996 const GLenum MAX_VIEWPORT_DIMS = 0x0D3A;
997 const GLenum SUBPIXEL_BITS = 0x0D50;
998 const GLenum RED_BITS = 0x0D52;
999 const GLenum GREEN_BITS = 0x0D53;
1000 const GLenum BLUE_BITS = 0x0D54;
1001 const GLenum ALPHA_BITS = 0x0D55;
1002 const GLenum DEPTH_BITS = 0x0D56;
1003 const GLenum STENCIL_BITS = 0x0D57;
1004 const GLenum POLYGON_OFFSET_UNITS = 0x2A00;
1005 /* POLYGON_OFFSET_FILL */
1006 const GLenum POLYGON_OFFSET_FACTOR = 0x8038;
1007 const GLenum TEXTURE_BINDING_2D = 0x8069;
1008 const GLenum SAMPLE_BUFFERS = 0x80A8;
1009 const GLenum SAMPLES = 0x80A9;
1010 const GLenum SAMPLE_COVERAGE_VALUE = 0x80AA;
1011 const GLenum SAMPLE_COVERAGE_INVERT = 0x80AB;
1012
1013 /* GetTextureParameter */
1014 /* TEXTURE_MAG_FILTER */
1015 /* TEXTURE_MIN_FILTER */
1016 /* TEXTURE_WRAP_S */
1017 /* TEXTURE_WRAP_T */
1018
1019 const GLenum NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2;
1020 const GLenum COMPRESSED_TEXTURE_FORMATS = 0x86A3;
1021
1022 /* HintMode */
1023 const GLenum DONT_CARE = 0x1100;
1024 const GLenum FASTEST = 0x1101;
1025 const GLenum NICEST = 0x1102;
1026
1027 /* HintTarget */
1028 const GLenum GENERATE_MIPMAP_HINT = 0x8192;
1029
1030 /* DataType */
1031 const GLenum BYTE = 0x1400;
1032 const GLenum UNSIGNED_BYTE = 0x1401;
1033 const GLenum SHORT = 0x1402;
1034 const GLenum UNSIGNED_SHORT = 0x1403;
1035 const GLenum INT = 0x1404;
1036 const GLenum UNSIGNED_INT = 0x1405;
1037 const GLenum FLOAT = 0x1406;
1038
1039 /* PixelFormat */
1040 const GLenum DEPTH_COMPONENT = 0x1902;
1041 const GLenum ALPHA = 0x1906;
1042 const GLenum RGB = 0x1907;
1043 const GLenum RGBA = 0x1908;
1044 const GLenum LUMINANCE = 0x1909;
1045 const GLenum LUMINANCE_ALPHA = 0x190A;
1046
1047 /* PixelType */
1048 /* UNSIGNED_BYTE */
1049 const GLenum UNSIGNED_SHORT_4_4_4_4 = 0x8033;
1050 const GLenum UNSIGNED_SHORT_5_5_5_1 = 0x8034;
1051 const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363;
1052
1053 /* Shaders */
1054 const GLenum FRAGMENT_SHADER = 0x8B30;
1055 const GLenum VERTEX_SHADER = 0x8B31;
1056 const GLenum MAX_VERTEX_ATTRIBS = 0x8869;
1057 const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB;
1058 const GLenum MAX_VARYING_VECTORS = 0x8DFC;
1059 const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
1060 const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C;
1061 const GLenum MAX_TEXTURE_IMAGE_UNITS = 0x8872;
1062 const GLenum MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD;
1063 const GLenum SHADER_TYPE = 0x8B4F;
1064 const GLenum DELETE_STATUS = 0x8B80;
1065 const GLenum LINK_STATUS = 0x8B82;
1066 const GLenum VALIDATE_STATUS = 0x8B83;
1067 const GLenum ATTACHED_SHADERS = 0x8B85;
1068 const GLenum ACTIVE_UNIFORMS = 0x8B86;
1069 const GLenum ACTIVE_ATTRIBUTES = 0x8B89;
1070 const GLenum SHADING_LANGUAGE_VERSION = 0x8B8C;
1071 const GLenum CURRENT_PROGRAM = 0x8B8D;
1072
1073 /* StencilFunction */
1074 const GLenum NEVER = 0x0200;
1075 const GLenum LESS = 0x0201;
1076 const GLenum EQUAL = 0x0202;
1077 const GLenum LEQUAL = 0x0203;
1078 const GLenum GREATER = 0x0204;
1079 const GLenum NOTEQUAL = 0x0205;
1080 const GLenum GEQUAL = 0x0206;
1081 const GLenum ALWAYS = 0x0207;
1082
1083 /* StencilOp */
1084 /* ZERO */
1085 const GLenum KEEP = 0x1E00;
1086 const GLenum REPLACE = 0x1E01;
1087 const GLenum INCR = 0x1E02;
1088 const GLenum DECR = 0x1E03;
1089 const GLenum INVERT = 0x150A;
1090 const GLenum INCR_WRAP = 0x8507;
1091 const GLenum DECR_WRAP = 0x8508;
1092
1093 /* StringName */
1094 const GLenum VENDOR = 0x1F00;
1095 const GLenum RENDERER = 0x1F01;
1096 const GLenum VERSION = 0x1F02;
1097
1098 /* TextureMagFilter */
1099 const GLenum NEAREST = 0x2600;
1100 const GLenum LINEAR = 0x2601;
1101
1102 /* TextureMinFilter */
1103 /* NEAREST */
1104 /* LINEAR */
1105 const GLenum NEAREST_MIPMAP_NEAREST = 0x2700;
1106 const GLenum LINEAR_MIPMAP_NEAREST = 0x2701;
1107 const GLenum NEAREST_MIPMAP_LINEAR = 0x2702;
1108 const GLenum LINEAR_MIPMAP_LINEAR = 0x2703;
1109
1110 /* TextureParameterName */
1111 const GLenum TEXTURE_MAG_FILTER = 0x2800;
1112 const GLenum TEXTURE_MIN_FILTER = 0x2801;
1113 const GLenum TEXTURE_WRAP_S = 0x2802;
1114 const GLenum TEXTURE_WRAP_T = 0x2803;
1115
1116 /* TextureTarget */
1117 const GLenum TEXTURE_2D = 0x0DE1;
1118 const GLenum TEXTURE = 0x1702;
1119
1120 const GLenum TEXTURE_CUBE_MAP = 0x8513;
1121 const GLenum TEXTURE_BINDING_CUBE_MAP = 0x8514;
1122 const GLenum TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
1123 const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
1124 const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
1125 const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
1126 const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
1127 const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A;
1128 const GLenum MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C;
1129
1130 /* TextureUnit */
1131 const GLenum TEXTURE0 = 0x84C0;
1132 const GLenum TEXTURE1 = 0x84C1;
1133 const GLenum TEXTURE2 = 0x84C2;
1134 const GLenum TEXTURE3 = 0x84C3;
1135 const GLenum TEXTURE4 = 0x84C4;
1136 const GLenum TEXTURE5 = 0x84C5;
1137 const GLenum TEXTURE6 = 0x84C6;
1138 const GLenum TEXTURE7 = 0x84C7;
1139 const GLenum TEXTURE8 = 0x84C8;
1140 const GLenum TEXTURE9 = 0x84C9;
1141 const GLenum TEXTURE10 = 0x84CA;
1142 const GLenum TEXTURE11 = 0x84CB;
1143 const GLenum TEXTURE12 = 0x84CC;
1144 const GLenum TEXTURE13 = 0x84CD;
1145 const GLenum TEXTURE14 = 0x84CE;
1146 const GLenum TEXTURE15 = 0x84CF;
1147 const GLenum TEXTURE16 = 0x84D0;
1148 const GLenum TEXTURE17 = 0x84D1;
1149 const GLenum TEXTURE18 = 0x84D2;
1150 const GLenum TEXTURE19 = 0x84D3;
1151 const GLenum TEXTURE20 = 0x84D4;
1152 const GLenum TEXTURE21 = 0x84D5;
1153 const GLenum TEXTURE22 = 0x84D6;
1154 const GLenum TEXTURE23 = 0x84D7;
1155 const GLenum TEXTURE24 = 0x84D8;
1156 const GLenum TEXTURE25 = 0x84D9;
1157 const GLenum TEXTURE26 = 0x84DA;
1158 const GLenum TEXTURE27 = 0x84DB;
1159 const GLenum TEXTURE28 = 0x84DC;
1160 const GLenum TEXTURE29 = 0x84DD;
1161 const GLenum TEXTURE30 = 0x84DE;
1162 const GLenum TEXTURE31 = 0x84DF;
1163 const GLenum ACTIVE_TEXTURE = 0x84E0;
1164
1165 /* TextureWrapMode */
1166 const GLenum REPEAT = 0x2901;
1167 const GLenum CLAMP_TO_EDGE = 0x812F;
1168 const GLenum MIRRORED_REPEAT = 0x8370;
1169
1170 /* Uniform Types */
1171 const GLenum FLOAT_VEC2 = 0x8B50;
1172 const GLenum FLOAT_VEC3 = 0x8B51;
1173 const GLenum FLOAT_VEC4 = 0x8B52;
1174 const GLenum INT_VEC2 = 0x8B53;
1175 const GLenum INT_VEC3 = 0x8B54;
1176 const GLenum INT_VEC4 = 0x8B55;
1177 const GLenum BOOL = 0x8B56;
1178 const GLenum BOOL_VEC2 = 0x8B57;
1179 const GLenum BOOL_VEC3 = 0x8B58;
1180 const GLenum BOOL_VEC4 = 0x8B59;
1181 const GLenum FLOAT_MAT2 = 0x8B5A;
1182 const GLenum FLOAT_MAT3 = 0x8B5B;
1183 const GLenum FLOAT_MAT4 = 0x8B5C;
1184 const GLenum SAMPLER_2D = 0x8B5E;
1185 const GLenum SAMPLER_CUBE = 0x8B60;
1186
1187 /* Vertex Arrays */
1188 const GLenum VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622;
1189 const GLenum VERTEX_ATTRIB_ARRAY_SIZE = 0x8623;
1190 const GLenum VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624;
1191 const GLenum VERTEX_ATTRIB_ARRAY_TYPE = 0x8625;
1192 const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A;
1193 const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645;
1194 const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
1195
1196 /* Shader Source */
1197 const GLenum COMPILE_STATUS = 0x8B81;
1198
1199 /* Shader Precision-Specified Types */
1200 const GLenum LOW_FLOAT = 0x8DF0;
1201 const GLenum MEDIUM_FLOAT = 0x8DF1;
1202 const GLenum HIGH_FLOAT = 0x8DF2;
1203 const GLenum LOW_INT = 0x8DF3;
1204 const GLenum MEDIUM_INT = 0x8DF4;
1205 const GLenum HIGH_INT = 0x8DF5;
1206
1207 /* Framebuffer Object. */
1208 const GLenum FRAMEBUFFER = 0x8D40;
1209 const GLenum RENDERBUFFER = 0x8D41;
1210
1211 const GLenum RGBA4 = 0x8056;
1212 const GLenum RGB5_A1 = 0x8057;
1213 const GLenum RGB565 = 0x8D62;
1214 const GLenum DEPTH_COMPONENT16 = 0x81A5;
1215 const GLenum STENCIL_INDEX = 0x1901;
1216 const GLenum STENCIL_INDEX8 = 0x8D48;
1217 const GLenum DEPTH_STENCIL = 0x84F9;
1218
1219 const GLenum RENDERBUFFER_WIDTH = 0x8D42;
1220 const GLenum RENDERBUFFER_HEIGHT = 0x8D43;
1221 const GLenum RENDERBUFFER_INTERNAL_FORMAT = 0x8D44;
1222 const GLenum RENDERBUFFER_RED_SIZE = 0x8D50;
1223 const GLenum RENDERBUFFER_GREEN_SIZE = 0x8D51;
1224 const GLenum RENDERBUFFER_BLUE_SIZE = 0x8D52;
1225 const GLenum RENDERBUFFER_ALPHA_SIZE = 0x8D53;
1226 const GLenum RENDERBUFFER_DEPTH_SIZE = 0x8D54;
1227 const GLenum RENDERBUFFER_STENCIL_SIZE = 0x8D55;
1228
1229 const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0;
1230 const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1;
1231 const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2;
1232 const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
1233
1234 const GLenum COLOR_ATTACHMENT0 = 0x8CE0;
1235 const GLenum DEPTH_ATTACHMENT = 0x8D00;
1236 const GLenum STENCIL_ATTACHMENT = 0x8D20;
1237 const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A;
1238
1239 const GLenum NONE = 0;
1240
1241 const GLenum FRAMEBUFFER_COMPLETE = 0x8CD5;
1242 const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6;
1243 const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
1244 const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9;
1245 const GLenum FRAMEBUFFER_UNSUPPORTED = 0x8CDD;
1246
1247 const GLenum FRAMEBUFFER_BINDING = 0x8CA6;
1248 const GLenum RENDERBUFFER_BINDING = 0x8CA7;
1249 const GLenum MAX_RENDERBUFFER_SIZE = 0x84E8;
1250
1251 const GLenum INVALID_FRAMEBUFFER_OPERATION = 0x0506;
1252
1253 /* WebGL-specific enums */
1254 const GLenum UNPACK_FLIP_Y_WEBGL = 0x9240;
1255 const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
1256 const GLenum CONTEXT_LOST_WEBGL = 0x9242;
1257 const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
1258 const GLenum BROWSER_DEFAULT_WEBGL = 0x9244;
1259
1260 readonly attribute HTMLCanvasElement canvas;
1261 readonly attribute GLsizei drawingBufferWidth;
1262 readonly attribute GLsizei drawingBufferHeight;
1263
1264 WebGLContextAttributes getContextAttributes();
1265 boolean isContextLost();
1266
1267 DOMString[ ] getSupportedExtensions();
1268 object getExtension(DOMString name);
1269
1270 void activeTexture(GLenum texture);
1271 void attachShader(WebGLProgram program, WebGLShader shader);
1272 void bindAttribLocation(WebGLProgram program, GLuint index, DOMString name);
1273 void bindBuffer(GLenum target, WebGLBuffer buffer);
1274 void bindFramebuffer(GLenum target, WebGLFramebuffer framebuffer);
1275 void bindRenderbuffer(GLenum target, WebGLRenderbuffer renderbuffer);
1276 void bindTexture(GLenum target, WebGLTexture texture);
1277 void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) ;
1278 void blendEquation(GLenum mode);
1279 void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
1280 void blendFunc(GLenum sfactor, GLenum dfactor);
1281 void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
1282 GLenum srcAlpha, GLenum dstAlpha);
1283
1284 void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
1285 void bufferData(GLenum target, ArrayBufferView data, GLenum usage);
1286 void bufferData(GLenum target, ArrayBuffer data, GLenum usage);
1287 void bufferSubData(GLenum target, GLintptr offset, ArrayBufferView data);
1288 void bufferSubData(GLenum target, GLintptr offset, ArrayBuffer data);
1289
1290 GLenum checkFramebufferStatus(GLenum target);
1291 void clear(GLbitfield mask);
1292 void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) ;
1293 void clearDepth(GLclampf depth);
1294 void clearStencil(GLint s);
1295 void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alp ha);
1296 void compileShader(WebGLShader shader);
1297
1298 void copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
1299 GLint x, GLint y, GLsizei width, GLsizei height,
1300 GLint border);
1301 void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoff set,
1302 GLint x, GLint y, GLsizei width, GLsizei height);
1303
1304 WebGLBuffer createBuffer();
1305 WebGLFramebuffer createFramebuffer();
1306 WebGLProgram createProgram();
1307 WebGLRenderbuffer createRenderbuffer();
1308 WebGLShader createShader(GLenum type);
1309 WebGLTexture createTexture();
1310
1311 void cullFace(GLenum mode);
1312
1313 void deleteBuffer(WebGLBuffer buffer);
1314 void deleteFramebuffer(WebGLFramebuffer framebuffer);
1315 void deleteProgram(WebGLProgram program);
1316 void deleteRenderbuffer(WebGLRenderbuffer renderbuffer);
1317 void deleteShader(WebGLShader shader);
1318 void deleteTexture(WebGLTexture texture);
1319
1320 void depthFunc(GLenum func);
1321 void depthMask(GLboolean flag);
1322 void depthRange(GLclampf zNear, GLclampf zFar);
1323 void detachShader(WebGLProgram program, WebGLShader shader);
1324 void disable(GLenum cap);
1325 void disableVertexAttribArray(GLuint index);
1326 void drawArrays(GLenum mode, GLint first, GLsizei count);
1327 void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset);
1328
1329 void enable(GLenum cap);
1330 void enableVertexAttribArray(GLuint index);
1331 void finish();
1332 void flush();
1333 void framebufferRenderbuffer(GLenum target, GLenum attachment,
1334 GLenum renderbuffertarget,
1335 WebGLRenderbuffer renderbuffer);
1336 void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget ,
1337 WebGLTexture texture, GLint level);
1338 void frontFace(GLenum mode);
1339
1340 void generateMipmap(GLenum target);
1341
1342 WebGLActiveInfo getActiveAttrib(WebGLProgram program, GLuint index);
1343 WebGLActiveInfo getActiveUniform(WebGLProgram program, GLuint index);
1344 WebGLShader[ ] getAttachedShaders(WebGLProgram program);
1345
1346 GLint getAttribLocation(WebGLProgram program, DOMString name);
1347
1348 any getParameter(GLenum pname);
1349 any getBufferParameter(GLenum target, GLenum pname);
1350
1351 GLenum getError();
1352
1353 any getFramebufferAttachmentParameter(GLenum target, GLenum attachment,
1354 GLenum pname);
1355 any getProgramParameter(WebGLProgram program, GLenum pname);
1356 DOMString getProgramInfoLog(WebGLProgram program);
1357 any getRenderbufferParameter(GLenum target, GLenum pname);
1358 any getShaderParameter(WebGLShader shader, GLenum pname);
1359 DOMString getShaderInfoLog(WebGLShader shader);
1360
1361 DOMString getShaderSource(WebGLShader shader);
1362
1363 any getTexParameter(GLenum target, GLenum pname);
1364
1365 any getUniform(WebGLProgram program, WebGLUniformLocation location);
1366
1367 WebGLUniformLocation getUniformLocation(WebGLProgram program, DOMString name );
1368
1369 any getVertexAttrib(GLuint index, GLenum pname);
1370
1371 GLsizeiptr getVertexAttribOffset(GLuint index, GLenum pname);
1372
1373 void hint(GLenum target, GLenum mode);
1374 GLboolean isBuffer(WebGLBuffer buffer);
1375 GLboolean isEnabled(GLenum cap);
1376 GLboolean isFramebuffer(WebGLFramebuffer framebuffer);
1377 GLboolean isProgram(WebGLProgram program);
1378 GLboolean isRenderbuffer(WebGLRenderbuffer renderbuffer);
1379 GLboolean isShader(WebGLShader shader);
1380 GLboolean isTexture(WebGLTexture texture);
1381 void lineWidth(GLfloat width);
1382 void linkProgram(WebGLProgram program);
1383 void pixelStorei(GLenum pname, GLint param);
1384 void polygonOffset(GLfloat factor, GLfloat units);
1385
1386 void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
1387 GLenum format, GLenum type, ArrayBufferView pixels);
1388
1389 void renderbufferStorage(GLenum target, GLenum internalformat,
1390 GLsizei width, GLsizei height);
1391 void sampleCoverage(GLclampf value, GLboolean invert);
1392 void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
1393
1394 void shaderSource(WebGLShader shader, DOMString source);
1395
1396 void stencilFunc(GLenum func, GLint ref, GLuint mask);
1397 void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
1398 void stencilMask(GLuint mask);
1399 void stencilMaskSeparate(GLenum face, GLuint mask);
1400 void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
1401 void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) ;
1402
1403 void texImage2D(GLenum target, GLint level, GLenum internalformat,
1404 GLsizei width, GLsizei height, GLint border, GLenum format,
1405 GLenum type, ArrayBufferView pixels);
1406 void texImage2D(GLenum target, GLint level, GLenum internalformat,
1407 GLenum format, GLenum type, ImageData pixels);
1408 void texImage2D(GLenum target, GLint level, GLenum internalformat,
1409 GLenum format, GLenum type, HTMLImageElement image);
1410 void texImage2D(GLenum target, GLint level, GLenum internalformat,
1411 GLenum format, GLenum type, HTMLCanvasElement canvas);
1412 void texImage2D(GLenum target, GLint level, GLenum internalformat,
1413 GLenum format, GLenum type, HTMLVideoElement video);
1414
1415 void texParameterf(GLenum target, GLenum pname, GLfloat param);
1416 void texParameteri(GLenum target, GLenum pname, GLint param);
1417
1418 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
1419 GLsizei width, GLsizei height,
1420 GLenum format, GLenum type, ArrayBufferView pixels);
1421 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
1422 GLenum format, GLenum type, ImageData pixels);
1423 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
1424 GLenum format, GLenum type, HTMLImageElement image);
1425 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
1426 GLenum format, GLenum type, HTMLCanvasElement canvas);
1427 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
1428 GLenum format, GLenum type, HTMLVideoElement video);
1429
1430 void uniform1f(WebGLUniformLocation location, GLfloat x);
1431 void uniform1fv(WebGLUniformLocation location, Float32Array v);
1432 void uniform1fv(WebGLUniformLocation location, float[] v);
1433 void uniform1i(WebGLUniformLocation location, GLint x);
1434 void uniform1iv(WebGLUniformLocation location, Int32Array v);
1435 void uniform1iv(WebGLUniformLocation location, long[] v);
1436 void uniform2f(WebGLUniformLocation location, GLfloat x, GLfloat y);
1437 void uniform2fv(WebGLUniformLocation location, Float32Array v);
1438 void uniform2fv(WebGLUniformLocation location, float[] v);
1439 void uniform2i(WebGLUniformLocation location, GLint x, GLint y);
1440 void uniform2iv(WebGLUniformLocation location, Int32Array v);
1441 void uniform2iv(WebGLUniformLocation location, long[] v);
1442 void uniform3f(WebGLUniformLocation location, GLfloat x, GLfloat y, GLfloat z);
1443 void uniform3fv(WebGLUniformLocation location, Float32Array v);
1444 void uniform3fv(WebGLUniformLocation location, float[] v);
1445 void uniform3i(WebGLUniformLocation location, GLint x, GLint y, GLint z);
1446 void uniform3iv(WebGLUniformLocation location, Int32Array v);
1447 void uniform3iv(WebGLUniformLocation location, long[] v);
1448 void uniform4f(WebGLUniformLocation location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
1449 void uniform4fv(WebGLUniformLocation location, Float32Array v);
1450 void uniform4fv(WebGLUniformLocation location, float[] v);
1451 void uniform4i(WebGLUniformLocation location, GLint x, GLint y, GLint z, GLi nt w);
1452 void uniform4iv(WebGLUniformLocation location, Int32Array v);
1453 void uniform4iv(WebGLUniformLocation location, long[] v);
1454
1455 void uniformMatrix2fv(WebGLUniformLocation location, GLboolean transpose,
1456 Float32Array value);
1457 void uniformMatrix2fv(WebGLUniformLocation location, GLboolean transpose,
1458 float[] value);
1459 void uniformMatrix3fv(WebGLUniformLocation location, GLboolean transpose,
1460 Float32Array value);
1461 void uniformMatrix3fv(WebGLUniformLocation location, GLboolean transpose,
1462 float[] value);
1463 void uniformMatrix4fv(WebGLUniformLocation location, GLboolean transpose,
1464 Float32Array value);
1465 void uniformMatrix4fv(WebGLUniformLocation location, GLboolean transpose,
1466 float[] value);
1467
1468 void useProgram(WebGLProgram program);
1469 void validateProgram(WebGLProgram program);
1470
1471 void vertexAttrib1f(GLuint indx, GLfloat x);
1472 void vertexAttrib1fv(GLuint indx, Float32Array values);
1473 void vertexAttrib1fv(GLuint indx, float[] values);
1474 void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
1475 void vertexAttrib2fv(GLuint indx, Float32Array values);
1476 void vertexAttrib2fv(GLuint indx, float[] values);
1477 void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
1478 void vertexAttrib3fv(GLuint indx, Float32Array values);
1479 void vertexAttrib3fv(GLuint indx, float[] values);
1480 void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) ;
1481 void vertexAttrib4fv(GLuint indx, Float32Array values);
1482 void vertexAttrib4fv(GLuint indx, float[] values);
1483 void vertexAttribPointer(GLuint indx, GLint size, GLenum type,
1484 GLboolean normalized, GLsizei stride, GLintptr offs et);
1485
1486 void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
1487 };</pre>
1488
1489 <!-- =========================================================================== ============================ -->
1490
1491 <h4>Attributes</h4>
1492
1493 <p>
1494 The following attributes are available:
1495 </p>
1496
1497 <dl class="methods">
1498 <dt>
1499 <code class=attribute-name>
1500 <a id="DOM-WebGLRenderingContext-canvas">
1501 canvas
1502 </a>
1503 </code>
1504 of type <code>HTMLCanvasElement</code>
1505 <dd>
1506 A reference to the canvas element which created this context.
1507
1508 <dt>
1509 <code class=attribute-name>
1510 <a id="DOM-WebGLRenderingContext-drawingBufferWidth">
1511 drawingBufferWidth
1512 </a>
1513 </code>
1514 of type <code>GLsizei</code>
1515 <dd>
1516 The actual width of the drawing buffer. May be different from the
1517 <code>width</code> attribute of the <code>HTMLCanvasElement</code> i f
1518 the implementation is unable to satisfy the requested widthor height .
1519
1520 <dt>
1521 <code class=attribute-name>
1522 <a id="DOM-WebGLRenderingContext-drawingBufferHeight">
1523 drawingBufferHeight
1524 </a>
1525 </code>
1526 of type <code>GLsizei</code>
1527 <dd>
1528 The actual height of the drawing buffer. May be different from the
1529 <code>height</code> attribute of the <code>HTMLCanvasElement</code> if
1530 the implementation is unable to satisfy the requested width or heigh t.
1531 </dl>
1532
1533 <!-- =========================================================================== ============================ -->
1534
1535 <h4>Getting information about the context</h4>
1536
1537 <dl class="methods">
1538 <dt class="idl-code">WebGLContextAttributes getContextAttributes()
1539 <dd>
1540 Returns the WebGLContextAttributes describing the current drawing bu ffer.
1541 </dl>
1542
1543 <!-- =========================================================================== ============================ -->
1544
1545 <h4>Setting and getting state</h4>
1546
1547 <p>
1548 OpenGL ES 2.0 maintains state values for use in rendering. All the calls in this
1549 group behave identically to their OpenGL counterparts unless otherwise n oted.
1550 </p>
1551
1552 <dl class="methods">
1553 <dt class="idl-code">void activeTexture(GLenum texture)
1554 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7">OpenGL ES 2.0 &sect;3. 7</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glActiveTexture.xml">man page</a>)</span>
1555 <dt class="idl-code"void blendColor(GLclampf red, GLclampf green, GLclam pf blue, GLclampf alpha)
1556 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.1.6">OpenGL ES 2.0 &sect; 4.1.6</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glBlendColor.xml">man page</a>)</span>
1557 <dt class="idl-code">void blendEquation(GLenum mode)
1558 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.1.6">OpenGL ES 2.0 &sect; 4.1.6</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glBlendEquation.xml">man page</a>)</span>
1559 <dt class="idl-code">void blendEquationSeparate(GLenum modeRGB, GLenum m odeAlpha)
1560 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.1.6">OpenGL ES 2.0 &sect; 4.1.6</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glBlendEquationSeparate.xml">man page</a>)</span>
1561 <dt class="idl-code">void blendFunc(GLenum sfactor, GLenum dfactor)
1562 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.1.6">OpenGL ES 2.0 &sect; 4.1.6</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glBlendFunc.xml">man page</a>)</span>
1563 <dd>
1564 See <a href="#CONSTANT_COLOR_BLEND">Blending With Constant Color </a> for limitations imposed
1565 by WebGL.
1566 <dt class="idl-code">void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB , GLenum srcAlpha, GLenum dstAlpha)
1567 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.1.6">OpenGL ES 2.0 &sect; 4.1.6</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glBlendFuncSeparate.xml">man page</a>)</span>
1568 <dd>
1569 See <a href="#CONSTANT_COLOR_BLEND">Blending With Constant Color </a> for limitations imposed
1570 by WebGL.
1571 <dt class="idl-code">void clearColor(GLclampf red, GLclampf green, GLcla mpf blue, GLclampf alpha)
1572 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.2.3">OpenGL ES 2.0 &sect; 4.2.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glClearColor.xml">man page</a>)</span>
1573 <dt class="idl-code">void clearDepth(GLclampf depth)
1574 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.2.3">OpenGL ES 2.0 &sect; 4.2.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glClearDepthf.xml">man page</a>)</span>
1575 <dd>
1576 <code>depth</code> value is clamped to the range 0 to 1.
1577 <dt class="idl-code">void clearStencil(GLint s)
1578 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.2.3">OpenGL ES 2.0 &sect; 4.2.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glClearStencil.xml">man page</a>)</span>
1579 <dt class="idl-code">void colorMask(GLboolean red, GLboolean green, GLbo olean blue, GLboolean alpha)
1580 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.2.2">OpenGL ES 2.0 &sect; 4.2.2</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glColorMask.xml">man page</a>)</span>
1581 <dt class="idl-code">void cullFace(GLenum mode)
1582 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.5.1">OpenGL ES 2.0 &sect; 3.5.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glCullFace.xml">man page</a>)</span>
1583 <dt class="idl-code">void depthFunc(GLenum func)
1584 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.1.5">OpenGL ES 2.0 &sect; 4.1.5</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glDepthFunc.xml">man page</a>)</span>
1585 <dt class="idl-code">void depthMask(GLboolean flag)
1586 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.2.2">OpenGL ES 2.0 &sect; 4.2.2</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glDepthMask.xml">man page</a>)</span>
1587 <dt class="idl-code">void depthRange(GLclampf zNear, GLclampf zFar)
1588 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.12.1">OpenGL ES 2.0 &sect ;2.12.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glDepthRangef.xml">man page</a>)</span>
1589 <dd>
1590 <code>zNear</code> and <code>zFar</code> values are clamped to t he range 0 to 1 and
1591 <code>zNear</code> must be less than or equal to <code>zFar</cod e>; see
1592 <a href="#VIEWPORT_DEPTH_RANGE">Viewport Depth Range</a>.
1593 <dt class="idl-code">void disable(GLenum cap)
1594 <span class="gl-spec">(<a class="nonnormative" href="http://www.khro nos.org/opengles/sdk/2.0/docs/man/glDisable.xml">man page</a>)</span>
1595 <dt class="idl-code">void enable(GLenum cap)
1596 <span class="gl-spec">(<a class="nonnormative" href="http://www.khro nos.org/opengles/sdk/2.0/docs/man/glEnable.xml">man page</a>)</span>
1597 <dt class="idl-code">void frontFace(GLenum mode)
1598 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.5.1">OpenGL ES 2.0 &sect; 3.5.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glFrontFace.xml">man page</a>)</span>
1599 <dt class="idl-code">any getParameter(GLenum pname)
1600 <a class="gl-spec" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glGet.xml">
1601 (glGet OpenGL ES 2.0 man page)
1602 </a>
1603 <a class="gl-spec" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glGetString.xml">
1604 (glGetString OpenGL ES 2.0 man page)
1605 </a>
1606 <dd>
1607 Return the value for the passed pname. The type returned is the natu ral type for the
1608 requested pname, as given in the following table:
1609 <table class="foo">
1610 <tr><th>pname</th><th>returned type</th></tr>
1611 <tr><td>ACTIVE_TEXTURE</td><td>unsigned long</td></tr>
1612 <tr><td>ALIASED_LINE_WIDTH_RANGE</td><td>Float32Array (with 2 el ements)</td></tr>
1613 <tr><td>ALIASED_POINT_SIZE_RANGE</td><td>Float32Array (with 2 el ements)</td></tr>
1614 <tr><td>ALPHA_BITS</td><td>long</td></tr>
1615 <tr><td>ARRAY_BUFFER_BINDING</td><td>WebGLBuffer</td></tr>
1616 <tr><td>BLEND</td><td>boolean</td></tr>
1617 <tr><td>BLEND_COLOR</td><td>Float32Array (with 4 values)</td></t r>
1618 <tr><td>BLEND_DST_ALPHA</td><td>unsigned long</td></tr>
1619 <tr><td>BLEND_DST_RGB</td><td>unsigned long</td></tr>
1620 <tr><td>BLEND_EQUATION_ALPHA</td><td>unsigned long</td></tr>
1621 <tr><td>BLEND_EQUATION_RGB</td><td>unsigned long</td></tr>
1622 <tr><td>BLEND_SRC_ALPHA</td><td>unsigned long</td></tr>
1623 <tr><td>BLEND_SRC_RGB</td><td>unsigned long</td></tr>
1624 <tr><td>BLUE_BITS</td><td>long</td></tr>
1625 <tr><td>COLOR_CLEAR_VALUE</td><td>Float32Array (with 4 values)</ td></tr>
1626 <tr><td>COLOR_WRITEMASK</td><td>boolean[] (with 4 values)</td></ tr>
1627 <tr><td>COMPRESSED_TEXTURE_FORMATS</td><td>null</td></tr>
1628 <tr><td>CULL_FACE</td><td>boolean</td></tr>
1629 <tr><td>CULL_FACE_MODE</td><td>unsigned long</td></tr>
1630 <tr><td>CURRENT_PROGRAM</td><td>WebGLProgram</td></tr>
1631 <tr><td>DEPTH_BITS</td><td>long</td></tr>
1632 <tr><td>DEPTH_CLEAR_VALUE</td><td>float</td></tr>
1633 <tr><td>DEPTH_FUNC</td><td>unsigned long</td></tr>
1634 <tr><td>DEPTH_RANGE</td><td>Float32Array (with 2 elements)</td>< /tr>
1635 <tr><td>DEPTH_TEST</td><td>boolean</td></tr>
1636 <tr><td>DEPTH_WRITEMASK</td><td>boolean</td></tr>
1637 <tr><td>DITHER</td><td>boolean</td></tr>
1638 <tr><td>ELEMENT_ARRAY_BUFFER_BINDING</td><td>WebGLBuffer</td></t r>
1639 <tr><td>FRAMEBUFFER_BINDING</td><td>WebGLFramebuffer</td></tr>
1640 <tr><td>FRONT_FACE</td><td>unsigned long</td></tr>
1641 <tr><td>GENERATE_MIPMAP_HINT</td><td>unsigned long</td></tr>
1642 <tr><td>GREEN_BITS</td><td>long</td></tr>
1643 <tr><td>LINE_WIDTH</td><td>float</td></tr>
1644 <tr><td>MAX_COMBINED_TEXTURE_IMAGE_UNITS</td><td>long</td></tr>
1645 <tr><td>MAX_CUBE_MAP_TEXTURE_SIZE</td><td>long</td></tr>
1646 <tr><td>MAX_FRAGMENT_UNIFORM_VECTORS</td><td>long</td></tr>
1647 <tr><td>MAX_RENDERBUFFER_SIZE</td><td>long</td></tr>
1648 <tr><td>MAX_TEXTURE_IMAGE_UNITS</td><td>long</td></tr>
1649 <tr><td>MAX_TEXTURE_SIZE</td><td>long</td></tr>
1650 <tr><td>MAX_VARYING_VECTORS</td><td>long</td></tr>
1651 <tr><td>MAX_VERTEX_ATTRIBS</td><td>long</td></tr>
1652 <tr><td>MAX_VERTEX_TEXTURE_IMAGE_UNITS</td><td>long</td></tr>
1653 <tr><td>MAX_VERTEX_UNIFORM_VECTORS</td><td>long</td></tr>
1654 <tr><td>MAX_VIEWPORT_DIMS</td><td>Int32Array (with 2 elements)</ td></tr>
1655 <tr><td>NUM_COMPRESSED_TEXTURE_FORMATS</td><td>long</td></tr>
1656 <tr><td>PACK_ALIGNMENT</td><td>long</td></tr>
1657 <tr><td>POLYGON_OFFSET_FACTOR</td><td>float</td></tr>
1658 <tr><td>POLYGON_OFFSET_FILL</td><td>boolean</td></tr>
1659 <tr><td>POLYGON_OFFSET_UNITS</td><td>float</td></tr>
1660 <tr><td>RED_BITS</td><td>long</td></tr>
1661 <tr><td>RENDERBUFFER_BINDING</td><td>WebGLRenderbuffer</td></tr>
1662 <tr><td>RENDERER</td><td>DOMString</td></tr>
1663 <tr><td>SAMPLE_BUFFERS</td><td>long</td></tr>
1664 <tr><td>SAMPLE_COVERAGE_INVERT</td><td>boolean</td></tr>
1665 <tr><td>SAMPLE_COVERAGE_VALUE</td><td>float</td></tr>
1666 <tr><td>SAMPLES</td><td>long</td></tr>
1667 <tr><td>SCISSOR_BOX</td><td>Int32Array (with 4 elements)</td></t r>
1668 <tr><td>SCISSOR_TEST</td><td>boolean</td></tr>
1669 <tr><td>SHADING_LANGUAGE_VERSION</td><td>DOMString</td></tr>
1670 <tr><td>STENCIL_BACK_FAIL</td><td>unsigned long</td></tr>
1671 <tr><td>STENCIL_BACK_FUNC</td><td>unsigned long</td></tr>
1672 <tr><td>STENCIL_BACK_PASS_DEPTH_FAIL</td><td>unsigned long</td>< /tr>
1673 <tr><td>STENCIL_BACK_PASS_DEPTH_PASS</td><td>unsigned long</td>< /tr>
1674 <tr><td>STENCIL_BACK_REF</td><td>long</td></tr>
1675 <tr><td>STENCIL_BACK_VALUE_MASK</td><td>unsigned long</td></tr>
1676 <tr><td>STENCIL_BACK_WRITEMASK</td><td>unsigned long</td></tr>
1677 <tr><td>STENCIL_BITS</td><td>long</td></tr>
1678 <tr><td>STENCIL_CLEAR_VALUE</td><td>long</td></tr>
1679 <tr><td>STENCIL_FAIL</td><td>unsigned long</td></tr>
1680 <tr><td>STENCIL_FUNC</td><td>unsigned long</td></tr>
1681 <tr><td>STENCIL_PASS_DEPTH_FAIL</td><td>unsigned long</td></tr>
1682 <tr><td>STENCIL_PASS_DEPTH_PASS</td><td>unsigned long</td></tr>
1683 <tr><td>STENCIL_REF</td><td>long</td></tr>
1684 <tr><td>STENCIL_TEST</td><td>boolean</td></tr>
1685 <tr><td>STENCIL_VALUE_MASK</td><td>unsigned long</td></tr>
1686 <tr><td>STENCIL_WRITEMASK</td><td>unsigned long</td></tr>
1687 <tr><td>SUBPIXEL_BITS</td><td>long</td></tr>
1688 <tr><td>TEXTURE_BINDING_2D</td><td>WebGLTexture</td></tr>
1689 <tr><td>TEXTURE_BINDING_CUBE_MAP</td><td>WebGLTexture</td></tr>
1690 <tr><td>UNPACK_ALIGNMENT</td><td>int</td></tr>
1691 <tr><td>UNPACK_COLORSPACE_CONVERSION_WEBGL</td><td>unsigned long </td></tr>
1692 <tr><td>UNPACK_FLIP_Y_WEBGL</td><td>boolean</td></tr>
1693 <tr><td>UNPACK_PREMULTIPLY_ALPHA_WEBGL</td><td>boolean</td></tr>
1694 <tr><td>VENDOR</td><td>DOMString</td></tr>
1695 <tr><td>VERSION</td><td>DOMString</td></tr>
1696 <tr><td>VIEWPORT</td><td>Int32Array (with 4 elements)</td></tr>
1697 </table><br>
1698 <p>The following <em>pname</em> arguments return a string describing some aspect of the current WebGL implementation:</p>
1699 <table>
1700 <tr><td>VERSION</td>
1701 <td>Returns a version or release number of the form <code>WebG L&lt;space&gt;1.0&lt;space&gt;&lt;vendor-specific information&gt;</code>.</td></ tr>
1702 <tr><td>SHADING_LANGUAGE_VERSION</td>
1703 <td>Returns a version or release number of the form <code>WebG L&lt;space&gt;GLSL&lt;space&gt;ES&lt;space&gt;1.0&lt;space&gt;&lt;vendor-specifi c information&gt;</code>.</td></tr>
1704 <tr><td>VENDOR</td>
1705 <td>Returns the company responsible for this WebGL implementat ion. This name does not change from release to release.</td></tr>
1706 <tr><td>RENDERER</td>
1707 <td>Returns the name of the renderer. This name is typically s pecific to a particular configuration of a hardware platform. It does not change from release to release.</td></tr>
1708 </table><br>
1709 <p>See <a href="#EXTENSION_QUERIES">Extension Queries</a> for inform ation on querying the
1710 available extensions in the current WebGL implementation.</p>
1711 <dt class="idl-code">GLenum getError()
1712 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.5">OpenGL ES 2.0 &sect;2. 5</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glGetError.xml">man page</a>)</span>
1713 <dd>
1714 See <a href="#WEBGLCONTEXTEVENT">WebGLContextEvent</a> for documenta tion of a
1715 WebGL-specific return value from getError.
1716 <dt class="idl-code">void hint(GLenum target, GLenum mode)
1717 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-5.2">OpenGL ES 2.0 &sect;5. 2</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glHint.xml">man page</a>)</span>
1718 <dt class="idl-code">GLboolean isEnabled(GLenum cap)
1719 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.1">OpenGL ES 2.0 &sect; 6.1.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glIsEnabled.xml">man page</a>)</span>
1720 <dt class="idl-code">void lineWidth(GLfloat width)
1721 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.4">OpenGL ES 2.0 &sect;3. 4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glLineWidth.xml">man page</a>)</span>
1722 <dt class="idl-code">void pixelStorei(GLenum pname, GLint param)
1723 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.6.1">OpenGL ES 2.0 &sect; 3.6.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glPixelStorei.xml">man page</a>)</span>
1724 <dd>
1725 In addition to the parameters in the OpenGL ES 2.0 specification , the WebGL
1726 specification accepts the parameters <code>UNPACK_FLIP_Y_WEBGL</ code>,
1727 <code>UNPACK_PREMULTIPLY_ALPHA_WEBGL</code>
1728 and <code>UNPACK_COLORSPACE_CONVERSION_WEBGL</code>. See <a href ="#PIXEL_STORAGE_PARAMETERS">Pixel
1729 Storage Parameters</a> for documentation of these parameters.
1730 <dt class="idl-code">void polygonOffset(GLfloat factor, GLfloat units)
1731 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.5.2">OpenGL ES 2.0 &sect; 3.5.2</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glPolygonOffset.xml">man page</a>)</span>
1732 <dt class="idl-code">void sampleCoverage(GLclampf value, GLboolean inver t)
1733 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.1.3">OpenGL ES 2.0 &sect; 4.1.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glSampleCoverage.xml">man page</a>)</span>
1734 <dt class="idl-code">void stencilFunc(GLenum func, GLint ref, GLuint mas k)
1735 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.1.4">OpenGL ES 2.0 &sect; 4.1.4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glStencilFunc.xml">man page</a>)</span>
1736 <dt class="idl-code">void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask)
1737 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.1.4">OpenGL ES 2.0 &sect; 4.1.4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glStencilFuncSeparate.xml">man page</a>)</span>
1738 <dd>
1739 See <a href="#STENCIL_SEPARATE_LIMIT">Stencil Separate Mask and Reference Value</a> for information
1740 on WebGL specific limitations to the allowable argument values.
1741 <dt class="idl-code">void stencilMask(GLuint mask)
1742 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.2.2">OpenGL ES 2.0 &sect; 4.2.2</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glStencilMask.xml">man page</a>)</span>
1743 <dd>
1744 See <a href="#STENCIL_SEPARATE_LIMIT">Stencil Separate Mask and Reference Value</a> for information
1745 on WebGL specific limitations to the allowable mask values.
1746 <dt class="idl-code">void stencilMaskSeparate(GLenum face, GLuint mask)
1747 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.2.2">OpenGL ES 2.0 &sect; 4.2.2</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glStencilMaskSeparate.xml">man page</a>)</span>
1748 <dt class="idl-code">void stencilOp(GLenum fail, GLenum zfail, GLenum zp ass)
1749 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.1.4">OpenGL ES 2.0 &sect; 4.1.4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glStencilOp.xml">man page</a>)</span>
1750 <dt class="idl-code">void stencilOpSeparate(GLenum face, GLenum fail, GL enum zfail, GLenum zpass)
1751 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.1.4">OpenGL ES 2.0 &sect; 4.1.4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glStencilOpSeparate.xml">man page</a>)</span>
1752 </dl>
1753
1754 <!-- =========================================================================== ============================ -->
1755
1756 <h4>Viewing and clipping</h4>
1757
1758 <p>
1759 The viewport specifies the affine transformation of x and y from normali zed device
1760 coordinates to window coordinates. The size of the drawing buffer is det ermined by
1761 the HTMLCanvasElement. The scissor box defines a rectangle which constra ins drawing.
1762 When the scissor test is enabled only pixels that lie within the scisso r box can
1763 be modified by drawing commands. When enabled drawing can only occur ins ide the
1764 intersection of the viewport, canvas area and the scissor box. When the scissor test
1765 is not enabled drawing can only occur inside the intersection of the vie wport and
1766 canvas area.
1767 </p>
1768
1769 <dl class="methods">
1770 <dt class="idl-code">void scissor(GLint x, GLint y, GLsizei width, GLsiz ei height)
1771 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.1.2">OpenGL ES 2.0 &sect; 4.1.2</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glScissor.xml">man page</a>)</span>
1772
1773 <dt class="idl-code">void viewport(GLint x, GLint y, GLsizei width, GLsi zei height)
1774 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.12.1">OpenGL ES 2.0 &sect ;2.12.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glViewport.xml">man page</a>)</span>
1775 </dl>
1776
1777 <!-- =========================================================================== ============================ -->
1778
1779 <h4>Buffer objects</h4>
1780
1781 <p>
1782 Buffer objects (sometimes referred to as VBOs) hold vertex attribute dat a for the GLSL
1783 shaders.
1784 </p>
1785
1786 <dl class="methods">
1787 <dt class="idl-code">void bindBuffer(GLenum target, WebGLBuffer buffer)
1788 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.9">OpenGL ES 2.0 &sect;2. 9</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glBindBuffer.xml">man page</a>)</span>
1789 <dd>
1790 Binds the given WebGLBuffer object to the given binding point (targe t), either
1791 ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER. If the buffer is null then any buffer currently
1792 bound to this target is unbound. A given WebGLBuffer object may only be bound to one of
1793 the ARRAY_BUFFER or ELEMENT_ARRAY_BUFFER target in its lifetime. An attempt to bind a
1794 buffer object to the other target will generate an <code>INVALID_OPE RATION</code> error, and the
1795 current binding will remain untouched.
1796
1797 <dt class="idl-code">void bufferData(GLenum target, GLsizeiptr size, GLe num usage)
1798 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.9">OpenGL ES 2.0 &sect;2. 9</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glBufferData.xml">man page</a>)</span>
1799 <dd>
1800 Set the size of the currently bound WebGLBuffer object for the passe d target. The
1801 buffer is initialized to 0.
1802
1803 <dt><p class="idl-code">void bufferData(GLenum target, ArrayBufferView d ata, GLenum usage)</p>
1804 <p class="idl-code">void bufferData(GLenum target, ArrayBuffer data, GLenum usage)
1805 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.9">OpenGL ES 2.0 &sect;2. 9</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glBufferData.xml">man page</a>)</span></p>
1806 <dd>
1807 Set the size of the currently bound WebGLBuffer object for the passe d target to the
1808 size of the passed data, then write the contents of data to the buff er object.
1809 <br><br>
1810 If the passed data is null then an <code>INVALID_VALUE</code> error is generated.
1811 <dt><p class="idl-code">void bufferSubData(GLenum target, GLintptr offse t, ArrayBufferView data)</p>
1812 <p class="idl-code">void bufferSubData(GLenum target, GLintptr offse t, ArrayBuffer data)
1813 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.9">OpenGL ES 2.0 &sect;2. 9</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glBufferSubData.xml">man page</a>)</span></p>
1814 <dd>
1815 For the WebGLBuffer object bound to the passed target write the pass ed data starting
1816 at the passed offset. If the data would be written past the end of t he buffer object
1817 an <code>INVALID_VALUE</code> error is generated.
1818
1819 <dt class="idl-code">WebGLBuffer createBuffer()
1820 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.9">OpenGL ES 2.0 &sect;2. 9</a>, similar to <a class="nonnormative" href="http://www.khronos.org/opengles/ sdk/2.0/docs/man/glGenBuffers.xml">glGenBuffers</a>)</span>
1821 <dd>
1822 Create a WebGLBuffer object and initialize it with a buffer object n ame as if by
1823 calling glGenBuffers.
1824
1825 <dt class="idl-code">void deleteBuffer(WebGLBuffer buffer)
1826 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.9">OpenGL ES 2.0 &sect;2. 9</a>, similar to <a class="nonnormative" href="http://www.khronos.org/opengles/ sdk/2.0/docs/man/glDeleteBuffers.xml">glDeleteBuffers</a>)</span>
1827 <dd>
1828 Delete the buffer object contained in the passed WebGLBuffer as if b y calling
1829 glDeleteBuffers. If the buffer has already been deleted the call has no effect.
1830 Note that the buffer object will be deleted when the WebGLBuffer obj ect is destroyed.
1831 This method merely gives the author greater control over when the bu ffer object is
1832 destroyed.
1833
1834 <dt class="idl-code">any getBufferParameter(GLenum target, GLenum pname)
1835 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.3">OpenGL ES 2.0 &sect; 6.1.3</a>, similar to <a class="nonnormative" href="http://www.khronos.org/openg les/sdk/2.0/docs/man/glGetBufferParameteriv.xml">glGetBufferParameteriv</a>)</sp an>
1836 <dd>
1837 Return the value for the passed pname. The type returned is the natu ral type for the
1838 requested pname, as given in the following table:
1839 <table class="foo">
1840 <tr><th>pname</th><th>returned type</th></tr>
1841 <tr><td>BUFFER_SIZE</td><td>long</td></tr>
1842 <tr><td>BUFFER_USAGE</td><td>unsigned long</td></tr>
1843 </table>
1844 <dt class="idl-code">GLboolean isBuffer(WebGLBuffer buffer)
1845 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.6">OpenGL ES 2.0 &sect; 6.1.6</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glIsBuffer.xml">man page</a>)</span>
1846 </dl>
1847
1848 <!-- =========================================================================== ============================ -->
1849
1850 <h4>Framebuffer objects</h4>
1851
1852 <p>
1853 Framebuffer objects provide an alternative rendering target to the drawi ng buffer. They
1854 are a collection of color, alpha, depth and stencil buffers and are ofte n used to
1855 render an image that will later be used as a texture.
1856 </p>
1857
1858 <dl class="methods">
1859 <dt class="idl-code">void bindFramebuffer(GLenum target, WebGLFramebuffe r framebuffer)
1860 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.1">OpenGL ES 2.0 &sect; 4.4.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glBindFramebuffer.xml">man page</a>)</span>
1861 <dd>
1862 Bind the given <code class="interface">WebGLFramebuffer</code> objec t to the given binding point
1863 (<code class="param">target</code>), which must be <code class="enum ">FRAMEBUFFER</code>.
1864 If <code class="param">framebuffer</code> is null, the default frame buffer provided by the context
1865 is bound and attempts to modify or query state on <code class="param ">target</code> <code class="enum">FRAMEBUFFER</code>
1866 will generate an <code class="error">INVALID_OPERATION</code> error.
1867
1868 <dt class="idl-code">GLenum checkFramebufferStatus(GLenum target)
1869 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.5">OpenGL ES 2.0 &sect; 4.4.5</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glCheckFramebufferStatus.xml">man page</a>)</span>
1870 <dt class="idl-code">WebGLFramebuffer createFramebuffer()
1871 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.1">OpenGL ES 2.0 &sect; 4.4.1</a>, similar to <a class="nonnormative" href="http://www.khronos.org/openg les/sdk/2.0/docs/man/glGenFramebuffers.xml">glGenFramebuffers</a>)</span>
1872 <dd>
1873 Create a WebGLFramebuffer object and initialize it with a framebuffe r object name as if by
1874 calling glGenFramebuffers.
1875
1876 <dt class="idl-code">void deleteFramebuffer(WebGLFramebuffer buffer)
1877 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.1">OpenGL ES 2.0 &sect; 4.4.1</a>, similar to <a class="nonnormative" href="http://www.khronos.org/openg les/sdk/2.0/docs/man/glDeleteFramebuffers.xml">glDeleteFramebuffers</a>)</span>
1878 <dd>
1879 Delete the framebuffer object contained in the passed WebGLFramebuff er as if by calling
1880 glDeleteFramebuffers. If the framebuffer has already been deleted th e call has no effect.
1881 Note that the framebuffer object will be deleted when the WebGLFrame buffer object is destroyed.
1882 This method merely gives the author greater control over when the fr amebuffer object is
1883 destroyed.
1884
1885 <dt class="idl-code">void framebufferRenderbuffer(GLenum target, GLenum attachment,
1886 GLenum renderbuffertarget,
1887 WebGLRenderbuffer renderbuffer)
1888 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.3">OpenGL ES 2.0 &sect; 4.4.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glFramebufferRenderbuffer.xml">man page</a>)</span></dt>
1889 <dt class="idl-code">void framebufferTexture2D(GLenum target, GLenum att achment, GLenum textarget,
1890 WebGLTexture texture, GLint level)
1891 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.3">OpenGL ES 2.0 &sect; 4.4.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glFramebufferTexture2D.xml">man page</a>)</span>
1892 <dt class="idl-code">any getFramebufferAttachmentParameter(GLenum target , GLenum attachment,
1893 GLenum pname)
1894 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.3">OpenGL ES 2.0 &sect; 6.1.3</a>, similar to <a class="nonnormative" href="http://www.khronos.org/openg les/sdk/2.0/docs/man/glGetFramebufferAttachmentParameteriv.xml">glGetFramebuffer AttachmentParameteriv</a>)</span>
1895 <dd>
1896 Return the value for the passed pname given the passed target and at tachment. The type
1897 returned is the natural type for the requested pname, as given in th e following table:
1898 <table class="foo">
1899 <tr><th>pname</th><th>returned type</th></tr>
1900 <tr><td>FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</td><td>unsigned long </td></tr>
1901 <tr><td>FRAMEBUFFER_ATTACHMENT_OBJECT_NAME</td><td>WebGLRenderbu ffer or WebGLTexture</td></tr>
1902 <tr><td>FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL</td><td>long</td></ tr>
1903 <tr><td>FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE</td><td>lon g</td></tr>
1904 </table>
1905 <dt class="idl-code">GLboolean isFramebuffer(WebGLFramebuffer framebuffe r)
1906 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.7">OpenGL ES 2.0 &sect; 6.1.7</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glIsFramebuffer.xml">man page</a>)</span>
1907 <dd>
1908 Return true if the passed WebGLFramebuffer is valid and false otherw ise.
1909 </dl>
1910
1911 <!-- =========================================================================== ============================ -->
1912
1913 <h4>Renderbuffer objects</h4>
1914
1915 <p>
1916 Renderbuffer objects are used to provide storage for the individual buff ers used in a
1917 framebuffer object.
1918 </p>
1919
1920 <dl class="methods">
1921 <dt class="idl-code">void bindRenderbuffer(GLenum target, WebGLRenderbuf fer renderbuffer)
1922 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.3">OpenGL ES 2.0 &sect; 4.4.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glBindRenderbuffer.xml">man page</a>)</span>
1923 <dd>
1924 Bind the given <code class="interface">WebGLRenderbuffer</code> obje ct to the given binding point
1925 (<code class="param">target</code>), which must be <code class="enum ">RENDERBUFFER</code>.
1926 If <code class="param">renderbuffer</code> is null the renderbuffer object currently bound to
1927 this <code class="param">target</code> is unbound.
1928
1929 <dt class="idl-code">WebGLRenderbuffer createRenderbuffer()
1930 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.3">OpenGL ES 2.0 &sect; 4.4.3</a>, similar to <a class="nonnormative" href="http://www.khronos.org/openg les/sdk/2.0/docs/man/glGenRenderbuffers.xml">glGenRenderbuffers</a>)</span>
1931 <dd>
1932 Create a WebGLRenderbuffer object and initialize it with a renderbuf fer object name as if by
1933 calling glGenRenderbuffers.
1934
1935 <dt class="idl-code">void deleteRenderbuffer(WebGLRenderbuffer renderbuf fer)
1936 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.3">OpenGL ES 2.0 &sect; 4.4.3</a>, similar to <a class="nonnormative" href="http://www.khronos.org/openg les/sdk/2.0/docs/man/glDeleteRenderbuffers.xml">glDeleteRenderbuffers</a>)</span >
1937 <dd>
1938 Delete the renderbuffer object contained in the passed WebGLRenderbu ffer as if by calling
1939 glDeleteRenderbuffers. If the renderbuffer has already been deleted the call has no effect.
1940 Note that the renderbuffer object will be deleted when the WebGLRend erbuffer object is destroyed.
1941 This method merely gives the author greater control over when the re nderbuffer object is
1942 destroyed.
1943 <dt class="idl-code">any getRenderbufferParameter(GLenum target, GLenum pname)
1944 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.3">OpenGL ES 2.0 &sect; 6.1.3</a>, similar to <a class="nonnormative" href="http://www.khronos.org/openg les/sdk/2.0/docs/man/glGetRenderbufferParameteriv.xml">glGetRenderbufferParamete riv</a>)</span>
1945 <dd>
1946 Return the value for the passed pname given the passed target. The t ype returned is the natural
1947 type for the requested pname, as given in the following table:
1948 <table class="foo">
1949 <tr><th>pname</th><th>returned type</th></tr>
1950 <tr><td>RENDERBUFFER_WIDTH</td><td>long</td></tr>
1951 <tr><td>RENDERBUFFER_HEIGHT</td><td>long</td></tr>
1952 <tr><td>RENDERBUFFER_INTERNAL_FORMAT</td><td>unsigned long</td>< /tr>
1953 <tr><td>RENDERBUFFER_RED_SIZE</td><td>long</td></tr>
1954 <tr><td>RENDERBUFFER_GREEN_SIZE</td><td>long</td></tr>
1955 <tr><td>RENDERBUFFER_BLUE_SIZE</td><td>long</td></tr>
1956 <tr><td>RENDERBUFFER_ALPHA_SIZE</td><td>long</td></tr>
1957 <tr><td>RENDERBUFFER_DEPTH_SIZE</td><td>long</td></tr>
1958 <tr><td>RENDERBUFFER_STENCIL_SIZE</td><td>long</td></tr>
1959 </table>
1960 <dt class="idl-code">GLboolean isRenderbuffer(WebGLRenderbuffer renderbu ffer)
1961 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.7">OpenGL ES 2.0 &sect; 6.1.7</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glIsRenderbuffer.xml">man page</a>)</span>
1962 <dd>
1963 Return true if the passed WebGLRenderbuffer is valid and false other wise.
1964 <dt class="idl-code">void renderbufferStorage(GLenum target, GLenum inte rnalformat,
1965 GLsizei width, GLsizei height)
1966 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.4.3">OpenGL ES 2.0 &sect; 4.4.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glRenderbufferStorage.xml">man page</a>)</span>
1967 </dl>
1968
1969 <!-- =========================================================================== ============================ -->
1970
1971 <h4>Texture objects</h4>
1972
1973 <p>
1974 Texture objects provide storage and state for texturing operations. If n o WebGLTexture is bound
1975 (e.g., passing null or 0 to bindTexture) then attempts to modify or quer y the texture object shall
1976 generate an <code>INVALID_OPERATION</code> error. This is indicated in t he functions below.
1977 </p>
1978
1979 <dl class="methods">
1980 <dt class="idl-code">void bindTexture(GLenum target, WebGLTexture textur e)
1981 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.13">OpenGL ES 2.0 &sect ;3.7.13</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glBindTexture.xml">man page</a>)</span>
1982 <dt class="idl-code">void copyTexImage2D(GLenum target, GLint level, GLe num internalformat,
1983 GLint x, GLint y, GLsizei width, GLsizei height,
1984 GLint border)
1985 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.2">OpenGL ES 2.0 &sect; 3.7.2</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glCopyTexImage2D.xml">man page</a>)</span>
1986 <dd>
1987 If an attempt is made to call this function with no WebGLTexture bou nd (see above), an
1988 <code>INVALID_OPERATION</code> error is generated. <br><br>
1989
1990 For any pixel lying outside the frame buffer, all channels of the as sociated texel are
1991 initialized to 0; see <a href="#READS_OUTSIDE_FRAMEBUFFER">Reading P ixels Outside the
1992 Framebuffer</a>.
1993 <dt class="idl-code">void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
1994 GLint x, GLint y, GLsizei width, GLsizei height)
1995 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.2">OpenGL ES 2.0 &sect; 3.7.2</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glCopyTexSubImage2D.xml">man page</a>)</span>
1996 <dd>
1997 If an attempt is made to call this function with no WebGLTexture bou nd (see above), an
1998 <code>INVALID_OPERATION</code> error is generated. <br><br>
1999
2000 For any pixel lying outside the frame buffer, all channels of the as sociated texel are
2001 initialized to 0; see <a href="#READS_OUTSIDE_FRAMEBUFFER">Reading P ixels Outside the
2002 Framebuffer</a>.
2003 <dt class="idl-code">WebGLTexture createTexture()
2004 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.13">OpenGL ES 2.0 &sect ;3.7.13</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glGenTextures.xml">man page</a>)</span>
2005 <dd>
2006 Create a WebGLTexture object and initialize it with a texture object name as if by
2007 calling glGenTextures.
2008
2009 <dt class="idl-code">void deleteTexture(WebGLTexture texture)
2010 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.13">OpenGL ES 2.0 &sect ;3.7.13</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glDeleteTextures.xml">man page</a>)</span>
2011 <dd>
2012 Delete the texture object contained in the passed WebGLTexture as if by calling
2013 glDeleteTextures. If the texture has already been deleted the call h as no effect.
2014 Note that the texture object will be deleted when the WebGLTexture o bject is destroyed.
2015 This method merely gives the author greater control over when the te xture object is
2016 destroyed.
2017 <dt class="idl-code">void generateMipmap(GLenum target)
2018 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.11">OpenGL ES 2.0 &sect ;3.7.11</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glGenerateMipmap.xml">man page</a>)</span>
2019 <dd>
2020 If an attempt is made to call this function with no WebGLTexture bou nd (see above), an
2021 <code>INVALID_OPERATION</code> error is generated.
2022 <dt class="idl-code">any getTexParameter(GLenum target, GLenum pname)
2023 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.3">OpenGL ES 2.0 &sect; 6.1.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glGetTexParameter.xml">man page</a>)</span>
2024 <dd>
2025 Return the value for the passed pname given the passed target. The t ype returned is the natural type for the
2026 requested pname, as given in the following table:
2027 <table class="foo">
2028 <tr><th>pname</th><th>returned type</th></tr>
2029 <tr><td>TEXTURE_MAG_FILTER</td><td>unsigned long</td></tr>
2030 <tr><td>TEXTURE_MIN_FILTER</td><td>unsigned long</td></tr>
2031 <tr><td>TEXTURE_WRAP_S</td><td>unsigned long</td></tr>
2032 <tr><td>TEXTURE_WRAP_T</td><td>unsigned long</td></tr>
2033 </table>
2034 <dd>
2035 If an attempt is made to call this function with no WebGLTexture bou nd (see above), an
2036 <code>INVALID_OPERATION</code> error is generated.
2037 <dt class="idl-code">GLboolean isTexture(WebGLTexture texture)
2038 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.4">OpenGL ES 2.0 &sect; 6.1.4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glIsTexture.xml">man page</a>)</span>
2039 <dd>
2040 Return true if the passed WebGLTexture is valid and false otherwise.
2041 <dt class="idl-code"><a name="TEXIMAGE2D">void texImage2D</a>(GLenum tar get, GLint level, GLenum internalformat,
2042 GLsizei width, GLsizei height, GLint border, GLenum format,
2043 GLenum type, ArrayBufferView pixels)
2044 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.1">OpenGL ES 2.0 &sect; 3.7.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glTexImage2D.xml">man page</a>)</span>
2045 <dd>
2046 If <code>pixels</code> is null, a buffer of sufficient size initiali zed to 0 is
2047 passed. <br><br>
2048
2049 If <code>pixels</code> is non-null, the type of <code>pixels</code> must match the type
2050 of the data to be read. If it is UNSIGNED_BYTE, a Uint8Array must be supplied; if it is
2051 UNSIGNED_SHORT_5_6_5, UNSIGNED_SHORT_4_4_4_4, or UNSIGNED_SHORT_5_5_ 5_1, a Uint16Array
2052 must be supplied. If the types do not match, an INVALID_OPERATION er ror is generated.
2053 <br><br>
2054
2055 If an attempt is made to call this function with no WebGLTexture bou nd (see above), an
2056 <code>INVALID_OPERATION</code> error is generated. <br><br>
2057
2058 See <a href="#PIXEL_STORAGE_PARAMETERS">Pixel Storage Parameters</a> for WebGL-specific
2059 pixel storage parameters that affect the behavior of this function.
2060 <dt><p class="idl-code"><a name="TEXIMAGE2D_HTML">void texImage2D</a>(GL enum target, GLint level, GLenum internalformat,
2061 GLenum format, GLenum type, ImageData pixels)</p>
2062 <p class="idl-code">void texImage2D(GLenum target, GLint level, GLen um internalformat,
2063 GLenum format, GLenum type, HTMLImageElement image)</p>
2064 <p class="idl-code">void texImage2D(GLenum target, GLint level, GLen um internalformat,
2065 GLenum format, GLenum type, HTMLCanvasElement canvas)</p>
2066 <p class="idl-code">void texImage2D(GLenum target, GLint level, GLen um internalformat,
2067 GLenum format, GLenum type, HTMLVideoElement video)
2068 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.1">OpenGL ES 2.0 &sect; 3.7.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glTexImage2D.xml">man page</a>)</span></p>
2069 <dd>
2070 Uploads the given element or image data to the currently bound WebGL Texture. <br><br>
2071
2072 The source image data is conceptually first converted to the data ty pe and format
2073 specified by the <em>format</em> and <em>type</em> arguments, and th en transferred to
2074 the OpenGL implementation. If a packed pixel format is specified whi ch would imply loss
2075 of bits of precision from the image data, this loss of precision mus t occur. <br><br>
2076
2077 If the source image is an RGB or RGBA lossless image with 8 bits per channel, the
2078 browser guarantees that the full precision of all channels is preser ved. <br><br>
2079
2080 If the original image contains an alpha channel and the
2081 <code>UNPACK_PREMULTIPLY_ALPHA_WEBGL</code> pixel storage parameter is false, then the
2082 RGB values are guaranteed to never have been premultiplied by the al pha channel, whether
2083 those values are derived directly from the original file format or c onverted from some
2084 other color format. <br><br>
2085
2086 If an attempt is made to call this function with no WebGLTexture bou nd (see above), an
2087 <code>INVALID_OPERATION</code> error is generated. <br><br>
2088
2089 See <a href="#PIXEL_STORAGE_PARAMETERS">Pixel Storage Parameters</a> for WebGL-specific
2090 pixel storage parameters that affect the behavior of this function.
2091 <dt class="idl-code">void texParameterf(GLenum target, GLenum pname, GLf loat param)
2092 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.4">OpenGL ES 2.0 &sect; 3.7.4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glTexParameter.xml">man page</a>)</span>
2093 <dd>
2094 If an attempt is made to call this function with no WebGLTexture bou nd (see above), an
2095 <code>INVALID_OPERATION</code> error is generated.
2096 <dt class="idl-code">void texParameteri(GLenum target, GLenum pname, GLi nt param)
2097 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.4">OpenGL ES 2.0 &sect; 3.7.4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glTexParameter.xml">man page</a>)</span>
2098 <dd>
2099 If an attempt is made to call this function with no WebGLTexture bou nd (see above), an
2100 <code>INVALID_OPERATION</code> error is generated.
2101 <dt class="idl-code">void texSubImage2D(GLenum target, GLint level, GLin t xoffset, GLint yoffset,
2102 GLsizei width, GLsizei height,
2103 GLenum format, GLenum type, ArrayBufferView pixels)
2104 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.2">OpenGL ES 2.0 &sect; 3.7.2</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glTexSubImage2D.xml">man page</a>)</span>
2105 <dd>
2106 See <a href="#TEXIMAGE2D">texImage2D</a> for restrictions on the <em >format</em>
2107 and <em>pixels</em> arguments. <br><br>
2108
2109 If an attempt is made to call this function with no WebGLTexture bou nd (see above), an
2110 <code>INVALID_OPERATION</code> error is generated. <br><br>
2111
2112 See <a href="#PIXEL_STORAGE_PARAMETERS">Pixel Storage Parameters</a> for WebGL-specific
2113 pixel storage parameters that affect the behavior of this function.
2114 <dt><p class="idl-code">void texSubImage2D(GLenum target, GLint level, G Lint xoffset, GLint yoffset,
2115 GLenum format, GLenum type, ImageData pixels)</p>
2116 <p class="idl-code">void texSubImage2D(GLenum target, GLint level, G Lint xoffset, GLint yoffset,
2117 GLenum format, GLenum type, HTMLImageElement image)</p>
2118 <p class="idl-code">void texSubImage2D(GLenum target, GLint level, G Lint xoffset, GLint yoffset,
2119 GLenum format, GLenum type, HTMLCanvasElement canvas)</p>
2120 <p class="idl-code">void texSubImage2D(GLenum target, GLint level, G Lint xoffset, GLint yoffset,
2121 GLenum format, GLenum type, HTMLVideoElement video)
2122 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-3.7.2">OpenGL ES 2.0 &sect; 3.7.2</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glTexSubImage2D.xml">man page</a>)</span></p>
2123 <dd>
2124 Updates a sub-rectangle of the currently bound WebGLTexture with the contents of the
2125 given element or image data. <br><br>
2126
2127 See <a href="#TEXIMAGE2D_HTML">texImage2D</a> for the interpretation of
2128 the <em>format</em> and <em>type</em> arguments. <br><br>
2129
2130 If an attempt is made to call this function with no WebGLTexture bou nd (see above), an
2131 <code>INVALID_OPERATION</code> error is generated. <br><br>
2132
2133 See <a href="#PIXEL_STORAGE_PARAMETERS">Pixel Storage Parameters</a> for WebGL-specific
2134 pixel storage parameters that affect the behavior of this function.
2135 </dl>
2136
2137 <!-- =========================================================================== ============================ -->
2138
2139 <h4>Programs and Shaders</h4>
2140
2141 <p>
2142 Rendering with OpenGL ES 2.0 requires the use of <i>shaders</i>, written in OpenGL ES's shading language, GLSL ES.
2143 Shaders must be loaded with a source string (shaderSource), compiled
2144 (compileShader) and attached to a <i>program</i> (attachShader) which mu st be linked
2145 (linkProgram) and then used (useProgram).
2146 </p>
2147
2148 <dl class="methods">
2149 <dt class="idl-code">void attachShader(WebGLProgram program, WebGLShader shader)
2150 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.3">OpenGL ES 2.0 &sect ;2.10.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glAttachShader.xml">man page</a>)</span>
2151 <dt class="idl-code">void bindAttribLocation(WebGLProgram program, GLuin t index, DOMString name)
2152 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.4">OpenGL ES 2.0 &sect ;2.10.4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glBindAttribLocation.xml">man page</a>)</span>
2153 <dd>
2154 See <a href="#CHARACTERS_OUTSIDE_VALID_SET">Characters Outside the G LSL Source Character
2155 Set</a> for additional validation performed by WebGL implementations .
2156 <dt class="idl-code">void compileShader(WebGLShader shader)
2157 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.1">OpenGL ES 2.0 &sect ;2.10.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glCompileShader.xml">man page</a>)</span>
2158 <dt class="idl-code">WebGLProgram createProgram()
2159 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.3">OpenGL ES 2.0 &sect ;2.10.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glCreateProgram.xml">man page</a>)</span>
2160 <dd>
2161 Create a WebGLProgram object and initialize it with a program object name as if by
2162 calling glCreateProgram.
2163
2164 <dt class="idl-code">WebGLShader createShader(type)
2165 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.1">OpenGL ES 2.0 &sect ;2.10.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glCreateShader.xml">man page</a>)</span>
2166 <dd>
2167 Create a WebGLShader object and initialize it with a shader object n ame as if by
2168 calling glCreateShader.
2169
2170 <dt class="idl-code">void deleteProgram(WebGLProgram program)
2171 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.3">OpenGL ES 2.0 &sect ;2.10.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glDeleteProgram.xml">man page</a>)</span>
2172 <dd>
2173 Delete the program object contained in the passed WebGLProgram as if by calling
2174 glDeleteProgram. If the program has already been deleted the call ha s no effect.
2175 Note that the program object will be deleted when the WebGLProgram o bject is destroyed.
2176 This method merely gives the author greater control over when the pr ogram object is
2177 destroyed.
2178 <dt class="idl-code">void deleteShader(WebGLShader shader)
2179 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.1">OpenGL ES 2.0 &sect ;2.10.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glDeleteShader.xml">man page</a>)</span>
2180 <dd>
2181 Delete the shader object contained in the passed WebGLShader as if b y calling
2182 glDeleteShader. If the shader has already been deleted the call has no effect.
2183 Note that the shader object will be deleted when the WebGLShader obj ect is destroyed.
2184 This method merely gives the author greater control over when the sh ader object is
2185 destroyed.
2186 <dt class="idl-code">void detachShader(WebGLProgram program, WebGLShader shader)
2187 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.3">OpenGL ES 2.0 &sect ;2.10.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glDetachShader.xml">man page</a>)</span>
2188 <dt class="idl-code">WebGLShader[ ] getAttachedShaders(WebGLProgram prog ram)
2189 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.8">OpenGL ES 2.0 &sect; 6.1.8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glGetAttachedShaders.xml">man page</a>)</span>
2190 <dd>
2191 Return the list of shaders attached to the passed program.
2192 <dt class="idl-code">any getProgramParameter(WebGLProgram program, GLenu m pname)
2193 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.8">OpenGL ES 2.0 &sect; 6.1.8</a>, similar to <a class="nonnormative" href="http://www.khronos.org/openg les/sdk/2.0/docs/man/glGetProgramiv.xml">man page</a>)</span>
2194 <dd>
2195 Return the value for the passed pname given the passed program. The type returned is the natural
2196 type for the requested pname, as given in the following table:
2197 <table class="foo">
2198 <tr><th>pname</th><th>returned type</th></tr>
2199 <tr><td>DELETE_STATUS</td><td>boolean</td></tr>
2200 <tr><td>LINK_STATUS</td><td>boolean</td></tr>
2201 <tr><td>VALIDATE_STATUS</td><td>boolean</td></tr>
2202 <tr><td>ATTACHED_SHADERS</td><td>long</td></tr>
2203 <tr><td>ACTIVE_ATTRIBUTES</td><td>long</td></tr>
2204 <tr><td>ACTIVE_UNIFORMS</td><td>long</td></tr>
2205 </table>
2206 <dt class="idl-code">DOMString getProgramInfoLog(WebGLProgram program)
2207 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.8">OpenGL ES 2.0 &sect; 6.1.8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glGetProgramInfoLog.xml">man page</a>)</span>
2208 <dt class="idl-code">any getShaderParameter(WebGLShader shader, GLenum p name)
2209 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.8">OpenGL ES 2.0 &sect; 6.1.8</a>, similar to <a class="nonnormative" href="http://www.khronos.org/openg les/sdk/2.0/docs/man/glGetShaderiv.xml">man page</a>)</span>
2210 <dd>
2211 Return the value for the passed pname given the passed shader. The t ype returned is the natural
2212 type for the requested pname, as given in the following table:
2213 <table class="foo">
2214 <tr><th>pname</th><th>returned type</th></tr>
2215 <tr><td>SHADER_TYPE</td><td>unsigned long</td></tr>
2216 <tr><td>DELETE_STATUS</td><td>boolean</td></tr>
2217 <tr><td>COMPILE_STATUS</td><td>boolean</td></tr>
2218 </table>
2219 <dt class="idl-code">DOMString getShaderInfoLog(WebGLShader shader)
2220 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.8">OpenGL ES 2.0 &sect; 6.1.8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glGetShaderInfoLog.xml">man page</a>)</span>
2221 <dt class="idl-code">DOMString getShaderSource(WebGLShader shader)
2222 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.8">OpenGL ES 2.0 &sect; 6.1.8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glGetShaderSource.xml">man page</a>)</span>
2223 <dt class="idl-code">GLboolean isProgram(WebGLProgram program)
2224 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.8">OpenGL ES 2.0 &sect; 6.1.8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glIsProgram.xml">man page</a>)</span>
2225 <dd>
2226 Return true if the passed WebGLProgram is valid and false otherwise.
2227 <dt class="idl-code">GLboolean isShader(WebGLShader shader)
2228 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.8">OpenGL ES 2.0 &sect; 6.1.8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glIsShader.xml">man page</a>)</span>
2229 <dd>
2230 Return true if the passed WebGLShader is valid and false otherwise.
2231 <dt class="idl-code">void linkProgram(WebGLProgram program)
2232 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.3">OpenGL ES 2.0 &sect ;2.10.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glLinkProgram.xml">man page</a>)</span>
2233 <dt class="idl-code">void shaderSource(WebGLShader shader, DOMString sou rce)
2234 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.1">OpenGL ES 2.0 &sect ;2.10.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glShaderSource.xml">man page</a>)</span>
2235 <dd>
2236 See <a href="#SUPPORTED_GLSL_CONSTRUCTS">Supported GLSL Constructs</ a>
2237 and <a href="#CHARACTERS_OUTSIDE_VALID_SET">Characters Outside the G LSL Source Character
2238 Set</a> for additional constructs supported by and validation perfor med by WebGL
2239 implementations.
2240 <dt class="idl-code">void useProgram(WebGLProgram program)
2241 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.3">OpenGL ES 2.0 &sect ;2.10.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glUseProgram.xml">man page</a>)</span>
2242 <dt class="idl-code">void validateProgram(WebGLProgram program)
2243 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.5">OpenGL ES 2.0 &sect ;2.10.5</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glValidateProgram.xml">man page</a>)</span>
2244 </dl>
2245
2246 <!-- =========================================================================== ============================ -->
2247
2248 <h4>Uniforms and attributes</h4>
2249
2250 <p>
2251 Values used by the shaders are passed in as uniforms or vertex attribute s.
2252 </p>
2253
2254 <dl class="methods">
2255 <dt class="idl-code">void disableVertexAttribArray(GLuint index)
2256 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.8">OpenGL ES 2.0 &sect;2. 8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glDisableVertexAttribArray.xml">man page</a>)</span>
2257 <dt class="idl-code">void enableVertexAttribArray(GLuint index)
2258 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.8">OpenGL ES 2.0 &sect;2. 8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glEnableVertexAttribArray.xml">man page</a>)</span>
2259 <dd>
2260 Enable the vertex attribute at <code>index</code> as an array. WebGL imposes additional
2261 rules beyond OpenGL ES 2.0 regarding enabled vertex attributes;
2262 see <a href="#ATTRIBS_AND_RANGE_CHECKING">Enabled Vertex Attributes and Range
2263 Checking</a>.
2264 <dt class="idl-code">WebGLActiveInfo getActiveAttrib(WebGLProgram progra m, GLuint index)
2265 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.4">OpenGL ES 2.0 &sect ;2.10.4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glGetActiveAttrib.xml">man page</a>)</span>
2266 <dd>
2267 Returns information about the size, type and name of the vertex attr ibute at the
2268 passed index of the passed program object.
2269 <dt class="idl-code">WebGLActiveInfo getActiveUniform(WebGLProgram progr am, GLuint index)
2270 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.4">OpenGL ES 2.0 &sect ;2.10.4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glGetActiveUniform.xml">man page</a>)</span>
2271 <dd>
2272 Returns information about the size, type and name of the uniform at the
2273 passed index of the passed program object.
2274 <dt class="idl-code">GLint getAttribLocation(WebGLProgram program, DOMSt ring name)
2275 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.4">OpenGL ES 2.0 &sect ;2.10.4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glGetAttribLocation.xml">man page</a>)</span>
2276 <dd>
2277 See <a href="#CHARACTERS_OUTSIDE_VALID_SET">Characters Outside the G LSL Source Character
2278 Set</a> for additional validation performed by WebGL implementations .
2279 <dt class="idl-code">any getUniform(WebGLProgram program, WebGLUniformLo cation location)
2280 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.8">OpenGL ES 2.0 &sect; 6.1.8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glGetUniform.xml">man page</a>)</span>
2281 <dd>
2282 Return the uniform value at the passed location in the passed progra m. The type returned is
2283 dependent on the uniform type, as shown in the following table:
2284 <table class="foo">
2285 <tr><th>uniform type</th><th>returned type</th></tr>
2286 <tr><td>boolean</td><td>boolean</td></tr>
2287 <tr><td>int</td><td>long</td></tr>
2288 <tr><td>float</td><td>float</td></tr>
2289 <tr><td>vec2</td><td>Float32Array (with 2 elements)</td></tr>
2290 <tr><td>ivec2</td><td>Int32Array (with 2 elements)</td></tr>
2291 <tr><td>bvec2</td><td>boolean[] (with 2 elements)</td></tr>
2292 <tr><td>vec3</td><td>Float32Array (with 3 elements)</td></tr>
2293 <tr><td>ivec3</td><td>Int32Array (with 3 elements)</td></tr>
2294 <tr><td>bvec3</td><td>boolean[] (with 3 elements)</td></tr>
2295 <tr><td>vec4</td><td>Float32Array (with 4 elements)</td></tr>
2296 <tr><td>ivec4</td><td>Int32Array (with 4 elements)</td></tr>
2297 <tr><td>bvec4</td><td>boolean[] (with 4 elements)</td></tr>
2298 <tr><td>mat2</td><td>Float32Array (with 4 elements)</td></tr>
2299 <tr><td>mat3</td><td>Float32Array (with 9 elements)</td></tr>
2300 <tr><td>mat4</td><td>Float32Array (with 16 elements)</td></tr>
2301 </table>
2302 <dt class="idl-code">WebGLUniformLocation getUniformLocation(WebGLProgra m program, DOMString name)
2303 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.4">OpenGL ES 2.0 &sect ;2.10.4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glGetUniformLocation.xml">man page</a>)</span>
2304 <dd>
2305 Return a WebGLUniformLocation object that represents the location of a specific uniform variable
2306 within a program object. The return value is null if name does not c orrespond to an active uniform
2307 variable in the passed program. <br><br>
2308
2309 See <a href="#CHARACTERS_OUTSIDE_VALID_SET">Characters Outside the G LSL Source Character
2310 Set</a> for additional validation performed by WebGL implementations .
2311 <dt class="idl-code">any getVertexAttrib(GLuint index, GLenum pname)
2312 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.8">OpenGL ES 2.0 &sect; 6.1.8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glGetVertexAttrib.xml">man page</a>)</span>
2313 <dd>
2314 Return the information requested in pname about the vertex attribute at the passed index. The
2315 type returned is dependent on the information requested, as shown in the following table:
2316 <table class="foo">
2317 <tr><th>pname</th><th>returned type</th></tr>
2318 <tr><td>VERTEX_ATTRIB_ARRAY_BUFFER_BINDING</td><td>WebGLBuffer</ td></tr>
2319 <tr><td>VERTEX_ATTRIB_ARRAY_ENABLED</td><td>boolean</td></tr>
2320 <tr><td>VERTEX_ATTRIB_ARRAY_SIZE</td><td>long</td></tr>
2321 <tr><td>VERTEX_ATTRIB_ARRAY_STRIDE</td><td>long</td></tr>
2322 <tr><td>VERTEX_ATTRIB_ARRAY_TYPE</td><td>unsigned long</td></tr>
2323 <tr><td>VERTEX_ATTRIB_ARRAY_NORMALIZED</td><td>boolean</td></tr>
2324 <tr><td>CURRENT_VERTEX_ATTRIB</td><td>Float32Array (with 4 eleme nts)</td></tr>
2325 </table>
2326 <dt class="idl-code">GLsizeiptr getVertexAttribOffset(GLuint index, GLen um pname)
2327 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-6.1.8">OpenGL ES 2.0 &sect; 6.1.8</a>, similar to <a class="nonnormative" href="http://www.khronos.org/openg les/sdk/2.0/docs/man/glGetVertexAttribPointerv.xml">man page</a>)</span>
2328 <dt><p class="idl-code">void uniform[1234][fi](WebGLUniformLocation loca tion, ...)</p>
2329 <p class="idl-code">void uniform[1234][fi]v(WebGLUniformLocation loc ation, ...)
2330 <p class="idl-code">void uniformMatrix[234]fv(WebGLUniformLocation l ocation, GLboolean transpose, ...)
2331 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.10.4">OpenGL ES 2.0 &sect ;2.10.4</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2 .0/docs/man/glUniform.xml">man page</a>)</span></p>
2332 <dd>
2333 Each of the uniform* functions above sets the specified uniform or u niforms to the
2334 values provided. If the passed <code>location</code> is not null and was not obtained
2335 from the currently used program via an earlier call to <code>getUnif ormLocation</code>,
2336 an <code>INVALID_OPERATION</code> error will be generated. If the pa ssed
2337 <code>location</code> is null, the data passed in will be silently i gnored and
2338 no uniform variables will be changed.
2339 <br><br>
2340 If the array passed to any of the vector forms (those ending in <cod e>v</code>) has an
2341 invalid length, an <code>INVALID_VALUE</code> error will be generate d. The length is
2342 invalid if it is too short for or is not an integer multiple of the assigned type.
2343 <dt><p class="idl-code">void vertexAttrib[1234]f(GLuint indx, ...)</p>
2344 <p class="idl-code">void vertexAttrib[1234]fv(GLuint indx, ...)
2345 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.7">OpenGL ES 2.0 &sect;2. 7</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glVertexAttrib.xml">man page</a>)</span></p>
2346 <dd>
2347 Sets the vertex attribute at the passed index to the given constant v alue. Values set via the
2348 <code>vertexAttrib</code> are guaranteed to be returned from the <cod e>getVertexAttrib</code> function
2349 with the <code>CURRENT_VERTEX_ATTRIB</code> param, even if there have been intervening calls to
2350 <code>drawArrays</code> or <code>drawElements</code>.
2351 <dt class="idl-code">void vertexAttribPointer(GLuint indx, GLint size, GL enum type,
2352 GLboolean normalized, GLsizei stride, GLintptr offse t)
2353 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.8">OpenGL ES 2.0 &sect;2. 8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glVertexAttribPointer.xml">man page</a>)</span>
2354 <dd>
2355 Assign the WebGLBuffer object currently bound to the ARRAY_BUFFER ta rget to the vertex
2356 attribute at the passed index. Size is number of components per attr ibute. Stride and
2357 offset are in units of bytes. Passed stride and offset must be appro priate for the
2358 passed type and size or an <code>INVALID_OPERATION</code> error will be
2359 generated; see <a href="#BUFFER_OFFSET_AND_STRIDE">Buffer Offset and Stride
2360 Requirements</a>. If no WebGLBuffer is bound to the ARRAY_BUFFER tar get,
2361 an <code>INVALID_OPERATION</code> error will be generated. In WebGL, the maximum
2362 supported stride is 255; see <a href="#VERTEX_STRIDE"> Vertex Attrib ute Data Stride</a>.
2363 </dl>
2364
2365 <!-- =========================================================================== ============================ -->
2366
2367 <h4>Writing to the drawing buffer</h4>
2368
2369 <p>
2370 OpenGL ES 2.0 has 3 calls which can render to the drawing buffer: <code> clear</code>,
2371 <code>drawArrays</code> and <code>drawElements</code>. Furthermore rende ring can
2372 be directed to the drawing buffer or to a Framebuffer object. When rende ring is
2373 directed to the drawing buffer, making any of the 3 rendering calls shal l
2374 cause the drawing buffer to be presented to the HTML page compositor at the start
2375 of the next compositing operation.
2376 </p>
2377
2378 <dl class="methods">
2379 <dt class="idl-code">void clear(GLbitfield mask)
2380 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.2.3">OpenGL ES 2.0 &sect; 4.2.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glClear.xml">man page</a>)</span>
2381 <dt class="idl-code">void drawArrays(GLenum mode, GLint first, GLsizei c ount)
2382 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.8">OpenGL ES 2.0 &sect;2. 8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glDrawArrays.xml">man page</a>)</span>
2383 <dd>
2384 If <em>first</em> is negative, an <code>INVALID_VALUE</code> error w ill be generated.
2385 <dt class="idl-code">void drawElements(GLenum mode, GLsizei count, GLenu m type, GLintptr offset)
2386 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-2.8">OpenGL ES 2.0 &sect;2. 8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glDrawElements.xml">man page</a>)</span>
2387 <dd>
2388 Draw using the currently bound element array buffer. The given offs et is in bytes, and
2389 must be a valid multiple of the size of the given type or an <code>I NVALID_OPERATION</code>
2390 error will be generated; see <a href="#BUFFER_OFFSET_AND_STRIDE">Buf fer Offset and Stride
2391 Requirements</a>. If <code>count</code> is greater than zero, then a non-null
2392 <code>WebGLBuffer</code> must be bound to the <code>ELEMENT_ARRAY_BU FFER</code> binding
2393 point or an <code>INVALID_OPERATION</code> error will be generated.< br><br>
2394
2395 WebGL performs additional error checking beyond that specified in Op enGL ES 2.0 during
2396 calls to <code>drawArrays</code>
2397 and <code>drawElements</code>. See <a href="#ATTRIBS_AND_RANGE_CHECK ING">Enabled Vertex
2398 Attributes and Range Checking</a>.
2399 <dt class="idl-code">void finish()
2400 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-5.1">OpenGL ES 2.0 &sect;5. 1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glFinish.xml">man page</a>)</span>
2401 <dt class="idl-code">void flush()
2402 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-5.1">OpenGL ES 2.0 &sect;5. 1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/doc s/man/glFlush.xml">man page</a>)</span>
2403 </dl>
2404
2405 <!-- =========================================================================== ============================ -->
2406
2407 <h4><a name="readpixels">Reading back pixels</a></h4>
2408
2409 <p>
2410 Pixels in the current framebuffer can be read back into an ArrayBufferVi ew object.
2411 </p>
2412
2413 <dl class="methods">
2414 <dt class="idl-code">void readPixels(GLint x, GLint y, GLsizei width, GL sizei height,
2415 GLenum format, GLenum type, ArrayBufferView pixels)
2416 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles /specs/2.0/es_full_spec_2.0.24.pdf#nameddest=section-4.3.1">OpenGL ES 2.0 &sect; 4.3.1</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0 /docs/man/glReadPixels.xml">man page</a>)</span>
2417 <dd>
2418 Fills <code>pixels</code> with the pixel data in the specified recta ngle of the frame
2419 buffer. The data returned from readPixels must be up-to-date as of t he most recently
2420 sent drawing command.
2421 <br><br>
2422
2423 The type of <code>pixels</code> must match the type of the data to b e read. For example,
2424 if it is UNSIGNED_BYTE, a Uint8Array must be supplied; if it is UNSI GNED_SHORT_5_6_5,
2425 UNSIGNED_SHORT_4_4_4_4, or UNSIGNED_SHORT_5_5_5_1, a Uint16Array mus t be supplied. If
2426 the types do not match, an INVALID_OPERATION error is generated.
2427 <br><br>
2428
2429 The following are the allowed format and type combinations:
2430
2431 <table class="foo">
2432 <tr><th>format</th><th>type</th></tr>
2433 <tr><td>RGBA</td><td>UNSIGNED_BYTE</td></tr>
2434 </table>
2435
2436 If <code>pixels</code> is null, an INVALID_VALUE error is generated. If
2437 <code>pixels</code> is non-null, but is not large enough to retrieve all of the pixels
2438 in the specified rectangle taking into account pixel store modes, an INVALID_OPERATION
2439 value is generated.
2440 <br><br>
2441
2442 For any pixel lying outside the frame buffer, the value read contain s 0 in all channels;
2443 see <a href="#READS_OUTSIDE_FRAMEBUFFER">Reading Pixels Outside the Framebuffer</a>.
2444 <br><br>
2445
2446 </dl>
2447
2448 <!-- =========================================================================== ============================ -->
2449
2450 <h4>Detecting context lost events</h4>
2451
2452 <p>
2453 Occurrences such as power events on mobile devices may cause the WebGL r endering context to
2454 be lost at any time and require the application to rebuild it;
2455 see <a href="#WEBGLCONTEXTEVENT">WebGLContextEvent</a> for more details. The
2456 following method assists in detecting context lost events.
2457 </p>
2458
2459 <dl class="methods">
2460 <dt class="idl-code">boolean isContextLost()
2461 <dd>
2462 Returns true if the context is in the lost state.
2463 </dl>
2464
2465 <!-- =========================================================================== ============================ -->
2466
2467 <h4>Detecting and enabling extensions</h4>
2468
2469 <p>
2470 An implementation of WebGL must not support any additional parameters, c onstants or functions
2471 without first enabling that functionality through the extension mechanis m. The
2472 <code>getSupportedExtensions</code> function returns an array of the ext ension strings supported
2473 by this implementation. Extension strings are case-insensitive. An exten sion is enabled by
2474 passing one of those strings to the <code>getExtension</code> function. This call returns an
2475 object which contains any constants or functions defined by that extensi on. The definition of
2476 that object is specific to the extension and must be defined by the exte nsion specification.
2477 </p>
2478 <p>
2479 Once an extension is enabled, no mechanism is provided to disable it. Mu ltiple calls to
2480 <code>getExtension</code> with the same extension string shall return th e same object. An
2481 attempt to use any features of an extension without first calling getExt ension to enable it
2482 must generate an appropriate GL error and must not make use of the featu re.
2483 </p>
2484 <p>
2485 This specification does not define any extensions. A separate <a href="# refsREGISTRY">WebGL
2486 extension registry</a> defines extensions that may be supported by a par ticular WebGL
2487 implementation.
2488 </p>
2489
2490 <dl class="methods">
2491 <dt class="idl-code">DOMString[ ] getSupportedExtensions()
2492 <dd>
2493 Returns an array of all the supported extension strings. Any string in this list, when
2494 passed to <code>getExtension</code> must return a valid object. Any other string passed to
2495 <code>getExtension</code> must return null.
2496
2497 <dt class="idl-code">object getExtension(DOMString name)
2498 <dd>
2499 Returns an object if the passed extension is supported, or null if n ot. The object
2500 returned from <code>getExtension</code> contains any constants or fu nctions used by the
2501 extension, if any. A returned object may have no constants or functi ons if the extension does
2502 not define any, but a unique object must still be returned. That obj ect is used to indicate
2503 that the extension has been enabled.
2504 </dl>
2505
2506 <!-- =========================================================================== ============================ -->
2507
2508 <h3><a name="WEBGLCONTEXTEVENT">WebGLContextEvent</a></h3>
2509
2510 <p>
2511 WebGL generates a WebGLContextEvent event in response to a status change to the WebGL rendering context
2512 associated with the HTMLCanvasElement which has a listener for this even t. Events are sent using
2513 the <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html">DOM Ev ent System</a>. Event types can
2514 include the loss or restoration of state, or the inability to create a c ontext.
2515 </p>
2516 <pre class="idl">
2517 interface <dfn id="WebGLContextLostEvent">WebGLContextEvent</dfn> : Event {
2518 readonly attribute DOMString statusMessage;
2519
2520 void initWebGLContextEvent(DOMString typeArg,
2521 boolean canBubbleArg,
2522 boolean cancelableArg,
2523 DOMString statusMessageArg);
2524 };</pre>
2525
2526 <h4>Attributes</h4>
2527
2528 <p>
2529 The following attributes are available:
2530 </p>
2531
2532 <dl class="methods">
2533 <dt><span class="prop-name"><code>statusMessage</code></span> of type <c ode>DOMString</code>
2534 <dd>
2535 A string containing additional information, or the empty string if n o additional information
2536 is available.
2537 </dl>
2538
2539 <h4>Methods</h4>
2540
2541 <p>
2542 The following methods are available:
2543 </p>
2544
2545 <dl class="methods">
2546 <dt class="idl-code">void initWebGLContextEvent(DOMString typeArg, boole an canBubbleArg, boolean cancelableArg,
2547 DOMString statusMessageA rg)
2548 <dd>
2549 Initialize the event created through the
2550 <a href="http://www.w3.org/TR/DOM-Level-2-Events/events.html#Events- Event">Event</a>
2551 interface. This method may only be called before the event has been dispatched via
2552 the <code>dispatchEvent</code> method, though it may be called multi ple times during
2553 that phase if necessary. If called multiple times, the final invocat ion takes
2554 precedence.
2555 <P>
2556 <b>Parameters</b>
2557 <dl>
2558 <dt><code>typeArg</code> of type <code>DOMString</code>
2559 <dd>Specifies the event type (see below).
2560 <dt><code>canBubbleArg</code> of type <code>boolean</code>
2561 <dd>Specifies whether or not the event can bubble.
2562 <dt><code>cancelableArg</code> of type <code>boolean</code>
2563 <dd>Specifies whether or not the event can be canceled.
2564 <dt><code>statusMessageArg</code> of type <code>DOMString</code>
2565 <dd>A string containing additional information, or the empty str ing if no additional information is available.
2566 </dl>
2567 <b>No Return Value</b><br>
2568 <b>No Exceptions</b><br>
2569 </dl>
2570
2571 <h4>Event Types</h4>
2572
2573 <dl class="methods">
2574 <dt class="idl-code">webglcontextlost
2575 <dd>
2576 This event occurs when some system activity external to WebGL causes the rendering context
2577 associated with the HTMLCanvasElement receiving the event to lose al l of its state. When this
2578 event type is delivered, the associated context is in a "lost" state . While the context is
2579 in the lost state:
2580
2581 <ul>
2582 <li> The context's <code>isContextLost</code> method returns <code>true< /code>.<br>
2583 <li> All methods returning <code>void</code> return immediately.<br>
2584 <li> All methods returning nullable values or <code>any</code> return <c ode>null</code>.<br>
2585 <li> <code>checkFramebufferStatus</code> returns <code>FRAMEBUFFER_UNSUP PORTED</code>.<br>
2586 <li> <code>getAttribLocation</code> returns <code>-1</code>.<br>
2587 <li> <code>getError</code> returns <code>CONTEXT_LOST_WEBGL</code> the f irst time it is
2588 called while the context is lost. Afterward it will return <code>NO _ERROR</code> until
2589 the context has been restored.<br>
2590 <li> <code>getVertexAttribOffset</code> returns <code>0</code>.<br>
2591 <li> All <code>is</code> queries return <code>false</code>.<br>
2592 </ul>
2593 <p>
2594 See the <code>webglcontextrestored</code> event type for information on
2595 resuming rendering after the context has been lost.
2596 <p><p>
2597 The <code>statusMessage</code> attribute is always the empty string for this event.
2598 </dl>
2599
2600 <dl class="methods">
2601 <dt class="idl-code">webglcontextrestored
2602 <dd>
2603 This event occurs when the WebGL implementation determines that a pr eviously lost context can
2604 be restored. The system only restores the context if a handler for t he
2605 <code>webglcontextrestored</code> event is installed on the HTMLCanv asElement associated with
2606 the context.
2607 <p><p>
2608 Once the context is restored, WebGL resources such as textures and b uffers that were created
2609 before the context was lost are no longer valid. The application mus t reinitialize the
2610 context's state and recreate all such resources.
2611 <p><p>
2612 The <code>statusMessage</code> attribute is always the empty string for this event.
2613 </dl>
2614
2615 <dl class="methods">
2616 <dt class="idl-code">webglcontextcreationerror
2617 <dd>
2618 This event occurs in response to a call to <code>getContext()</code> on the HTMLCanvasElement
2619 receiving the event, when some error occurs during that call. When s uch an error occurs
2620 the <code>getContext()</code> returns with a <code>null</code> value . Later, at the normal
2621 event delivery time, this event is delivered with the details of the failure. If the
2622 HTMLCanvasElement is listening for this event, it will be delivered whenever
2623 <code>getContext()</code> returns <code>null</code>.
2624 <p>
2625 The <code>statusMessage</code> attribute may contain a platform depe ndent string about the nature
2626 of the failure.
2627 </dl>
2628
2629 <div class="example">
2630 The following ECMAScript example shows how to register event listeners on a Canvas called
2631 <code>canvas1</code> which will receive context lost and restored events and restart the
2632 application. For completeness, it illustrates how an application performing asynchronous image
2633 loading would handle a context lost event at an arbitrary point in time.
2634 <pre>
2635 window.onload = init;
2636
2637 var g_gl;
2638 var g_canvas;
2639 var g_intervalId;
2640 var g_images = [];
2641 var g_imgURLs = [
2642 "someimage.jpg",
2643 "someotherimage.jpg",
2644 "yetanotherimage.png"
2645 ];
2646
2647 function init() {
2648 g_canvas = document.getElementById("canvas1");
2649 g_canvas.addEventListener("webglcontextlost", contextLostHandler, false);
2650 g_canvas.addEventListener("webglcontextrestored", contextRestoredHandler, fals e);
2651 g_gl = canvas.getContext("webgl");
2652
2653 for (var ii = 0; ii < g_imgURLs.length; ++ii) {
2654 // Create an image tag.
2655 var image = document.createElement('img');
2656
2657 // Create a texture for this image.
2658 image.texture = g_gl.createTexture();
2659
2660 // Mark the image as not loaded.
2661 image.loaded = false;
2662
2663 // Setup a load callback.
2664 image.onload = (function(image) {
2665 return function() {
2666 imageLoadedHandler(image);
2667 };
2668 }(image));
2669
2670 // Start the image loading.
2671 image.src = g_imgURLs[ii];
2672
2673 // Remember the image.
2674 g_images.push(image);
2675 }
2676
2677 g_intervalId = window.setInterval(renderHandler, 1000/60);
2678 }
2679
2680 function renderHandler() {
2681 // draw with textures.
2682 // ...
2683 }
2684
2685 function imageLoadedHandler(image) {
2686 // Mark the image as loaded.
2687 image.loaded = true;
2688
2689 // Copy the image to the texture.
2690 updateTexture(image);
2691 }
2692
2693 function updateTexture(image) {
2694 if (!g_gl.isContextLost() && image.loaded) {
2695 g_gl.bindTexture(g_gl.TEXTURE_2D, image.texture);
2696 g_gl.texImage2D(g_gl.TEXTURE_2D, 0, image);
2697 }
2698 }
2699
2700 function contextLostHandler() {
2701 // stop rendering.
2702 window.clearInterval(g_internvalId);
2703 }
2704
2705 function contextRestoredHandler() {
2706 // create new textures for all images and restore their contents.
2707 for (var ii = 0; ii < g_images.length; ++ii) {
2708 g_images[ii].texture = g_gl.createTexture();
2709 updateTexture(g_images[ii]);
2710 }
2711
2712 // Start rendering again.
2713 g_intervalId = window.setInterval(renderHandler, 1000/60);
2714 }
2715 </pre>
2716 </div>
2717
2718 <!-- =========================================================================== ============================ -->
2719
2720 <h2><a name="webgl_gl_differences">Differences Between WebGL and OpenGL ES 2 .0</a></h2>
2721
2722 <p>
2723
2724 This section describes changes made to the WebGL API relative to the OpenGL ES 2 .0 API to improve
2725 portability across various operating systems and devices.
2726
2727 </p>
2728
2729 <h3>Buffer Object Binding</h3>
2730
2731 <p>
2732
2733 In the WebGL API, a given buffer object may only be bound to one of the <code>AR RAY_BUFFER</code> or
2734 <code>ELEMENT_ARRAY_BUFFER</code> binding points in its lifetime. This restricti on implies that a
2735 given buffer object may contain either vertices or indices, but not both.
2736
2737 </p>
2738 <p>
2739
2740 The type of a WebGLBuffer is initialized the first time it is passed as an argum ent
2741 to <code>bindBuffer</code>. A subsequent call to <code>bindBuffer</code> which a ttempts to bind the
2742 same WebGLBuffer to the other binding point will generate an <code>INVALID_OPERA TION</code> error, and
2743 the state of the binding point will remain untouched.
2744
2745 </p>
2746
2747 <h3>No Client Side Arrays</h3>
2748
2749 <p>
2750
2751 The WebGL API does not support client-side arrays. If <code>vertexAttribPointer< /code> is called
2752 without a <code>WebGLBuffer</code> bound to the <code>ARRAY_BUFFER</code> bindin g point,
2753 an <code>INVALID_OPERATION</code> error is generated. If <code>drawElements</cod e> is called with
2754 a <code>count</code> greater than zero, and no <code>WebGLBuffer</code> is bound to
2755 the <code>ELEMENT_ARRAY_BUFFER</code> binding point, an <code>INVALID_OPERATION< /code> error is
2756 generated.
2757
2758 </p>
2759
2760 <h3><a name="BUFFER_OFFSET_AND_STRIDE">Buffer Offset and Stride Requirements </a></h3>
2761
2762 <p>
2763
2764 The <code>offset</code> arguments to <code>drawElements</code> and <code>vertexA ttribPointer</code>,
2765 and the <code>stride</code> argument to <code>vertexAttribPointer</code>, must b e a multiple of the
2766 size of the data type passed to the call, or an <code>INVALID_OPERATION</code> e rror is generated.
2767
2768 </p>
2769
2770
2771 <h3><a name="ATTRIBS_AND_RANGE_CHECKING">Enabled Vertex Attributes and Range Checking</a></h3>
2772
2773 <p>
2774
2775 If a vertex attribute is enabled as an array via <code>enableVertexAttribArray</ code> but no buffer
2776 is bound to that attribute via <code>bindBuffer</code> and <code>vertexAttribPoi nter</code>, then
2777 calls to <code>drawArrays</code> or <code>drawElements</code> will generate an
2778 <code>INVALID_OPERATION</code> error.
2779
2780 </p>
2781 <p>
2782
2783 If a vertex attribute is enabled as an array, a buffer is bound to that attribut e, and the attribute
2784 is consumed by the current program, then calls to <code>drawArrays</code>
2785 and <code>drawElements</code> will verify that each referenced vertex lies withi n the storage of the
2786 bound buffer. If the range specified in <code>drawArrays</code> or any reference d index
2787 in <code>drawElements</code> lies outside the storage of the bound buffer, an IN VALID_OPERATION
2788 error is generated and no geometry is drawn.
2789
2790 </p>
2791 <p>
2792
2793 If a vertex attribute is enabled as an array, a buffer is bound to that attribut e, but the attribute
2794 is not consumed by the current program, then regardless of the size of the bound buffer, it will not
2795 cause any error to be generated during a call to <code>drawArrays</code>
2796 or <code>drawElements</code>.
2797
2798 </p>
2799
2800 <h3>Framebuffer Object Attachments</h3>
2801
2802 <p>
2803
2804 WebGL adds the <code>DEPTH_STENCIL_ATTACHMENT</code> framebuffer object attachme nt point and
2805 the <code>DEPTH_STENCIL</code> renderbuffer internal format. To attach both dept h and stencil
2806 buffers to a framebuffer object, call <code>renderbufferStorage</code> with
2807 the <code>DEPTH_STENCIL</code> internal format, and then call <code>framebufferR enderbuffer</code>
2808 with the <code>DEPTH_STENCIL_ATTACHMENT</code> attachment point.
2809
2810 </p>
2811 <p>
2812
2813 A renderbuffer attached to the <code>DEPTH_ATTACHMENT</code> attachment point mu st be allocated with
2814 the <code>DEPTH_COMPONENT16</code> internal format. A renderbuffer attached to
2815 the <code>STENCIL_ATTACHMENT</code> attachment point must be allocated with
2816 the <code>STENCIL_INDEX8</code> internal format. A renderbuffer attached to
2817 the <code>DEPTH_STENCIL_ATTACHMENT</code> attachment point must be allocated wit h
2818 the <code>DEPTH_STENCIL</code> internal format.
2819
2820 </p>
2821 <p>
2822
2823 In the WebGL API, it is an error to concurrently attach renderbuffers to the fol lowing combinations
2824 of attachment points:
2825
2826 <ul>
2827 <li> <code>DEPTH_ATTACHMENT + DEPTH_STENCIL_ATTACHMENT</code>
2828 <li> <code>STENCIL_ATTACHMENT + DEPTH_STENCIL_ATTACHMENT</code>
2829 <li> <code>DEPTH_ATTACHMENT + STENCIL_ATTACHMENT</code>
2830 </ul>
2831
2832 If any of the constraints above are violated, then:
2833
2834 <ul>
2835 <li> <code>checkFramebufferStatus</code> must return <code>FRAMEBUFFER_UNSUPPORT ED</code>.
2836 <li> The following calls, which either modify or read the framebuffer, must gene rate
2837 an <code>INVALID_FRAMEBUFFER_OPERATION</code> error and return early, leavi ng the contents of
2838 the framebuffer, destination texture or destination memory untouched.
2839 <ul>
2840 <li> clear
2841 <li> copyTexImage2D
2842 <li> copyTexSubImage2D
2843 <li> drawArrays
2844 <li> drawElements
2845 <li> readPixels
2846 </ul>
2847 </ul>
2848
2849 <h3><a name="PIXEL_STORAGE_PARAMETERS">Pixel Storage Parameters</a></h3>
2850
2851 <p>
2852 The WebGL API supports the following additional parameters to <code>pixelStorei< /code>.
2853
2854 <dl>
2855 <dt><code>UNPACK_FLIP_Y_WEBGL</code> of type <code>boolean</code>
2856 <dd>If set, then during any subsequent calls to <code>texImage2D</code> or
2857 <code>texSubImage2D</code>, the source data is flipped along the vertical axis, so that conceptually
2858 the last row is the first one transferred. The default value is <code>false</cod e>. Any non-zero
2859 value is interpreted as <code>true</code>.
2860
2861 <dt><code>UNPACK_PREMULTIPLY_ALPHA_WEBGL</code> of type <code>boolean</code>
2862 <dd>If set, then during any subsequent calls to <code>texImage2D</code>
2863 or <code>texSubImage2D</code>, the alpha channel of the source data, if present, is multiplied into
2864 the color channels during the data transfer. The default value is <code>false</c ode>. Any non-zero
2865 value is interpreted as <code>true</code>.
2866
2867 <dt><code>UNPACK_COLORSPACE_CONVERSION_WEBGL</code> of type <code>unsigned long< /code>
2868 <dd>If set to <code>BROWSER_DEFAULT_WEBGL</code>, then the browser's default col orspace conversion
2869 is applied during subsequent <code>texImage2D</code> and <code>texSubImage2D</co de> calls
2870 taking <code>HTMLImageElement</code>. The precise conversions may be specific to both the browser
2871 and file type. If set to <code>NONE</code>, no colorspace conversion is applied. The default value
2872 is <code>BROWSER_DEFAULT_WEBGL</code>.
2873
2874 </dl>
2875
2876 <h3><a name="READS_OUTSIDE_FRAMEBUFFER">Reading Pixels Outside the Framebuffer</ a></h3>
2877
2878 <p>
2879 In the WebGL API, functions which read the framebuffer
2880 (<code>copyTexImage2D</code>, <code>copyTexSubImage2D</code>, and <code>readPixe ls</code>) are
2881 defined to generate the RGBA value (0, 0, 0, 0) for any pixel which is outside o f the bound
2882 framebuffer.
2883 </p>
2884
2885 <h3><a name="STENCIL_SEPARATE_LIMIT">Stencil Separate Mask and Reference Value</ a></h3>
2886
2887 <p>
2888 In the WebGL API it is illegal to specify a different mask or reference value fo r front facing and
2889 back facing triangles in stencil operations. A call to <code>drawArrays</code>
2890 or <code>drawElements</code> will generate an <code>INVALID_OPERATION</code> err or if:
2891
2892 <ul>
2893 <li> <code>STENCIL_WRITEMASK</code> != <code>STENCIL_BACK_WRITEMASK</code> (as s pecified by <code>stencilMaskSeparate</code> for the <code>mask</code> parameter associated with the FRONT and BACK values of <code>face</code>, respectively)
2894 <li> <code>STENCIL_VALUE_MASK</code> != <code>STENCIL_BACK_VALUE_MASK</code> (as specified by <code>stencilFuncSeparate</code> for the <code>mask</code> paramet er associated with the FRONT and BACK values of <code>face</code>, respectively)
2895 <li> <code>STENCIL_REF</code> != <code>STENCIL_BACK_REF</code> (as specified by <code>stencilFuncSeparate</code> for the <code>ref</code> parameter associated w ith the FRONT and BACK values of <code>face</code>, respectively)
2896 </ul>
2897
2898 </p>
2899
2900 <h3><a name="VERTEX_STRIDE">Vertex Attribute Data Stride</a></h3>
2901
2902 <p>
2903 The WebGL API supports vertex attribute data strides up to 255 bytes. A call to
2904 <code>vertexAttribPointer</code> will generate an <code>INVALID_VALUE</code> err or if the value for
2905 the stride parameter exceeds 255.
2906 </p>
2907
2908 <h3><a name="VIEWPORT_DEPTH_RANGE">Viewport Depth Range</a></h3>
2909
2910 <p>
2911 The WebGL API does not support depth ranges with where the near plane is mapped to a value greater
2912 than that of the far plane. A call to <code>depthRange</code> will generate an
2913 <code>INVALID_OPERATION</code> error if <code>zNear</code> is greater than <code >zFar</code>.
2914 </p>
2915
2916 <h3><a name="CONSTANT_COLOR_BLEND">Blending With Constant Color</a></h3>
2917
2918 <p>
2919 In the WebGL API, constant color and constant alpha cannot be used together as s ource and
2920 destination factors in the blend function. A call to <code>blendFunc</code> will generate an
2921 <code>INVALID_OPERATION</code> error if one of the two factors is set to <code>C ONSTANT_COLOR</code>
2922 or <code>ONE_MINUS_CONSTANT_COLOR</code> and the other to <code>CONSTANT_ALPHA</ code> or
2923 <code>ONE_MINUS_CONSTANT_ALPHA</code>. A call to <code>blendFuncSeparate</code> will generate an
2924 <code>INVALID_OPERATION</code> error if <code>srcRGB</code> is set to <code>CONS TANT_COLOR</code>
2925 or <code>ONE_MINUS_CONSTANT_COLOR</code> and <code>dstRGB</code> is set to <code >CONSTANT_ALPHA</code> or
2926 <code>ONE_MINUS_CONSTANT_ALPHA</code> or vice versa.
2927 </p>
2928
2929 <h3>Fixed point support</h3>
2930
2931 The WebGL API does not support the <code>GL_FIXED</code> data type.
2932
2933 <h3>GLSL Constructs</h3>
2934
2935 <p>
2936 Per <a href="#SUPPORTED_GLSL_CONSTRUCTS">Supported GLSL Constructs</a>, identifi ers starting with
2937 "webgl_" and "_webgl_" are reserved for use by WebGL.
2938 </p>
2939
2940 <h3><a name="EXTENSION_QUERIES">Extension Queries</a></h3>
2941
2942 <p>
2943
2944 In the OpenGL ES 2.0 API, the available extensions are determined by calling
2945 <code>glGetString(GL_EXTENSIONS)</code>, which returns a space-separated list of extension strings.
2946 In the WebGL API, the <code>EXTENSIONS</code> enumerant has been removed.
2947 Instead, <code>getSupportedExtensions</code> must be called to determine the set of available
2948 extensions.
2949
2950 </p>
2951
2952 <h3><a name="IMPLEMENTATION_READ_FORMAT">Implementation Color Read Format an d Type</a></h3>
2953
2954 <p>
2955
2956 In the OpenGL ES 2.0 API, the
2957 <code>IMPLEMENTATION_COLOR_READ_FORMAT</code> and
2958 <code>IMPLEMENTATION_COLOR_READ_TYPE</code> parameters are used to inform ap plications of an
2959 additional format and type combination that may be passed to <code>ReadPixel s</code>, in
2960 addition to the required <ncode>RGBA</code>/<code>UNSIGNED_BYTE</code> pair. In WebGL 1.0,
2961 the supported format and type combinations to <code>ReadPixels</code> are do cumented in the
2962 <a href="#readpixels">Reading back pixels</a> section. The <code>IMPLEMENTA TION_COLOR_READ_FORMAT</code>
2963 and <code>IMPLEMENTATION_COLOR_READ_TYPE</code> enumerants have been removed .
2964 </p>
2965
2966 <h3><a name="COMPRESSED_TEXTURE_SUPPORT">Compressed Texture Support</a></h3>
2967
2968 <p>
2969 WebGL does not support any compressed texture formats. Therefore the <code>C ompressedTexImage2D</code>
2970 and <code>CompressedTexSubImage2D</code> functions are not included in this specification.
2971 Likewise the <code>COMPRESSED_TEXTURE_FORMATS</code> and <code>NUM_COMPRESSE D_TEXTURE_FORMATS</code>
2972 parameters to <code>getParameter</code> will return the value null or zero.
2973 </p>
2974
2975 <h3><a name="MAX_GLSL_IDENTIFIER_NAME">Maximum GLSL Identifier Name Limit</a ></h3>
2976
2977 <p>
2978 The GLSL ES spec <a href="#refsGLES20GLSL">[GLES20GLSL]</a> does not define a limit to the length
2979 of identifier names. WebGL requires support of identifier names of at least 256 characters in length.
2980 </p>
2981
2982 <h3><a name="CHARACTERS_OUTSIDE_VALID_SET">Characters Outside the GLSL Sourc e Character Set</a></h3>
2983
2984 <p>
2985 The GLSL ES spec <a href="#refsGLES20GLSL">[GLES20GLSL]</a> defines the sour ce character set for
2986 the OpenGL ES shading language to be ISO/IEC 646:1991, commonly called ASCII <a href="#refsASCII">[ASCII]</a>.
2987 If a string containing a character not in this set is passed to any of the s hader-related entry
2988 points <code>bindAttribLocation</code>, <code>getAttribLocation</code>, <cod e>getUniformLocation</code>,
2989 or <code>shaderSource</code>, an <code>INVALID_VALUE</code> error will be ge nerated. The exception is
2990 that any character allowed in an HTML DOMString <a href="#refsDOMSTRING">[DO MSTRING]</a> may be used
2991 in GLSL comments. Such use must not generate an error.
2992 </p>
2993
2994 <div class="note">
2995 <p>
2996 Some GLSL implementations disallow characters outside the ASCII range, e ven in comments. In such
2997 cases the WebGL implementation needs to prevent errors in such cases. Th e recommended technique
2998 is to preprocess the GLSL string, removing all comments, but maintaining the line numbering by
2999 inserting newline characters as needed for debugging purposes.
3000 </p>
3001 </div>
3002
3003 <h3>String Length Queries</h3>
3004
3005 <p>
3006 In the WebGL API, the enumerants <code>INFO_LOG_LENGTH</code>, <code>SHADER_ SOURCE_LENGTH</code>,
3007 <code>ACTIVE_UNIFORM_MAX_LENGTH</code>, and <code>ACTIVE_ATTRIB_MAX_LENGTH</ code> have been removed. In
3008 the OpenGL ES 2.0 API, these enumerants are needed to determine the size of buffers passed to calls
3009 like <code>glGetActiveAttrib</code>. In the WebGL API, the analogous calls ( <code>getActiveAttrib</code>,
3010 <code>getActiveUniform</code>, <code>getProgramInfoLog</code>, <code>getShad erInfoLog</code>, and
3011 <code>getShaderSource</code>) all return <code>DOMString</code>.
3012 </p>
3013
3014 <!-- =========================================================================== ============================ -->
3015
3016 <h2>References</h2>
3017
3018 <h3>Normative references</h3>
3019 <dl>
3020
3021 <dt id="refsCANVAS">[CANVAS]</dt>
3022 <dd><cite><a href="http://www.w3.org/TR/html5/the-canvas-element.html">
3023 HTML5: The Canvas Element</a></cite>,
3024 World Wide Web Consortium (W3C).
3025 </dd>
3026 <dt id="refsTYPEDARRAYS">[TYPEDARRAYS]</dt>
3027 <dd><cite><a href="http://www.khronos.org/registry/typedarray/specs/late st/">
3028 Typed Array Specification: Editor's Draft</a></cite>,
3029 V. Vukicevic, K. Russell, May 2010.
3030 </dd>
3031 <dt id="refsGLES20">[GLES20]</dt>
3032 <dd><cite><a href="http://www.khronos.org/registry/gles/specs/2.0/es_ful l_spec_2.0.25.pdf">
3033 OpenGL&reg; ES Common Profile Specification Version 2.0.25</a></cite >,
3034 A. Munshi, J. Leech, November 2010.
3035 </dd>
3036 <dt id="refsGLES20GLSL">[GLES20GLSL]</dt>
3037 <dd><cite><a href="http://www.khronos.org/registry/gles/specs/2.0/GLSL_E S_Specification_1.0.17.pdf">
3038 The OpenGL&reg; ES Shading Language Version 1.00</a></cite>,
3039 R. Simpson, May 2009.
3040 </dd>
3041 <dt id="refsREGISTRY">[REGISTRY]</dt>
3042 <dd><cite><a href="http://www.khronos.org/registry/webgl/extensions/">
3043 WebGL Extension Registry</a></cite>
3044 </dd>
3045 <dt id="refsRFC2119">[RFC2119]</dt>
3046 <dd><cite><a href="http://www.ietf.org/rfc/rfc2119.txt">
3047 Key words for use in RFCs to Indicate Requirement Levels</a></cite>,
3048 S. Bradner. IETF, March 1997.
3049 </dd>
3050 <dt id="refsWEBIDL">[WEBIDL]</dt>
3051 <dd><cite><a href="http://dev.w3.org/2006/webapi/WebIDL/">
3052 Web IDL: W3C Editor’s Draft</a></cite>,
3053 C. McCormack, September 2009.
3054 </dd>
3055 <dt id="refsASCII">[ASCII]</dt>
3056 <dd><cite>International Standard ISO/IEC 646:1991. Information technolog y -
3057 ISO 7-bit coded character set for information interchange</cite>
3058 </dd>
3059 <dt id="refsDOMSTRING">[DOMSTRING]</dt>
3060 <dd><cite><a href="http://www.w3.org/TR/DOM-Level-2-Core/core.html#DOMSt ring">
3061 Document Object Model Core: The DOMString type</a></cite>,
3062 World Wide Web Consortium (W3C).
3063 </dd>
3064 </dl>
3065
3066 <h3>Other references</h3>
3067
3068 <!-- =========================================================================== ============================ -->
3069
3070 <h2>Acknowledgments</h2>
3071 <p>This specification is produced by the Khronos WebGL Working Group.</p>
3072
3073 <p>
3074 Special thanks to: Arun Ranganathan (Mozilla), Jon Leech, Kenneth Russell (Google),
3075 Kenneth Waters (Google), Mark Callow (HI), Mark Steele (Mozilla), Oliver Hunt (Apple),
3076 Tim Johansson (Opera), Vangelis Kokkevis (Google), Vladimir Vukicevic (Mo zilla),
3077 Gregg Tavares (Google)
3078 </p>
3079 <p>
3080 Additional thanks to: Alan Hudson (Yumetech), Bill Licea Kane (AMD), Ced ric Vivier (Zegami),
3081 Dan Gessel (Apple), David Ligon (Qualcomm), Greg Ross (Nvidia), Jacob St rom (Ericsson), Kari Pulli (Nokia),
3082 Leddie Stenvie (ST-Ericsson), Neil Trevett (Nvidia), Per Wennersten (Eri csson),
3083 Per-Erik Brodin (Ericsson), Shiki Okasaka (Google), Tom Olson (ARM), Zhe ngrong Yao (Ericsson),
3084 and the members of the Khronos WebGL Working Group.
3085 </p>
3086
3087 </body>
3088 </html>
OLDNEW
« no previous file with comments | « third_party/webgl/specs/latest/webgl.idl ('k') | third_party/webgl/specs/r13869/webgl.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698