1 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
2 "http://www.w3.org/TR/html4/strict.dtd">
5 <meta http-equiv="content-type" content="text/html; charset=utf-8">
6 <title>WebGL 2 Specification</title>
7 <meta name="generator" content="BBEdit 9.1">
8 <link rel="stylesheet" type="text/css" href="../../../resources/Khronos-WD.css" />
9 <script src="../../../resources/jquery-1.3.2.min.js" type="text/javascript"></script>
10 <script src="../../../resources/generateTOC.js" type="text/javascript"></script>
12 <body onload="generateTOC(document.getElementById('toc'))">
16 <a href="http://khronos.org/">
17 <img alt=Khronos height=60 src="../../../resources/KhronosGroup-3D.png" width=220>
23 <a href="http://webgl.org/">
24 <img alt=WebGL height=72 src="../../../resources/WebGL-Logo.png" width=156>
30 <h1>WebGL 2 Specification</h1>
31 <h2 class="no-toc">Editor's Draft 10 April 2014</h2>
35 <a href="https://www.khronos.org/registry/webgl/specs/latest/2.0/">
36 https://www.khronos.org/registry/webgl/specs/latest/2.0/
39 <a href="https://www.khronos.org/registry/webgl/specs/latest/2.0/webgl2.idl">
40 <b>WebIDL:</b> https://www.khronos.org/registry/webgl/specs/latest/2.0/webgl2.idl
45 <a href="https://www.khronos.org/registry/webgl/specs/latest/2.0/">
46 https://www.khronos.org/registry/webgl/specs/latest/2.0/
49 <a href="https://www.khronos.org/registry/webgl/specs/latest/2.0/webgl2.idl">
50 <b>WebIDL:</b> https://www.khronos.org/registry/webgl/specs/latest/2.0/webgl2.idl
55 <a href="https://www.khronos.org/registry/webgl/specs/1.0.2/">
56 https://www.khronos.org/registry/webgl/specs/1.0.2/
59 <a href="https://www.khronos.org/registry/webgl/specs/1.0.2/webgl.idl">
60 <b>WebIDL:</b> https://www.khronos.org/registry/webgl/specs/1.0.2/webgl.idl
65 <a href="mailto:dino@apple.com">Dean Jackson</a>
66 <a href="http://www.apple.com/">(Apple Inc.)</a>
70 <span style="font-size: x-small; font-style: oblique">Copyright © 2013 Khronos Group</span>
74 <h2 class="no-toc">Abstract</h2>
76 This is Version 2.0 of the WebGL Specification.
79 This specification describes an additional rendering context and support
81 <a href="http://www.w3.org/TR/html5/the-canvas-element.html"
82 title="HTML 5 Canvas Element">
83 HTML 5 <span class="prop-name">canvas</span> element <a href="#refsCANVAS">[CANVAS]</a>.
85 This context allows rendering using an API that conforms closely to the OpenGL ES 3.0 API.
88 This document should be read as an extension to the <a href="https://www.khronos.org/registry/webgl/specs/1.0.2/">
89 WebGL 1.0 specification</a>. It will only describe the differences from 1.0.</a>
91 <h2 class="no-toc">Status of this document</h2>
95 This document is an editor's draft. Do not cite this document as other than work in
96 progress. Public discussion of this specification is welcome on the
97 (<a href="https://www.khronos.org/webgl/public-mailing-list/archives/">archived</a>) WebGL
98 mailing list <a href="mailto:public_webgl@khronos.org">public_webgl@khronos.org</a> (see
99 <a href="http://www.khronos.org/webgl/public-mailing-list/">instructions</a>).
103 <h2 class="no-toc">Table of contents</h2>
106 <h2>Introduction</h2>
109 WebGL™ is an immediate mode 3D rendering API designed for the web. This is Version 2 of the
110 WebGL specification. It is derived from OpenGL® ES 3.0, and provides similar rendering
111 functionality, but in an HTML context.
115 WebGL 2 is backwards compatible with WebGL 1: existing content will run in WebGL 2 without
116 modification. To access the new behavior provided in this specification, the content
117 explicitly requests a new context (<a href="#">details below</a>).
124 Many functions described in this document contain links to OpenGL ES
125 man pages. While every effort is made to make these pages match the
126 OpenGL ES 3.0 specification <a href="#refsGLES30">[GLES30]</a>,
127 they may contain errors. In the case of a contradiction, the OpenGL
128 ES 3.0 specification is the final authority.
132 The remaining sections of this document are intended to be read in conjunction
133 with the OpenGL ES 3.0 specification (3.0.2 at the time of this writing, available
134 from the <a href="http://www.khronos.org/registry/gles/">Khronos OpenGL ES API Registry</a>).
135 Unless otherwise specified, the behavior of each method is defined by the
136 OpenGL ES 3.0 specification. This specification may diverge from OpenGL ES 3.0
137 in order to ensure interoperability or security, often defining areas that
138 OpenGL ES 3.0 leaves implementation-defined. These differences are summarized in the
139 <a href="#webgl_gl_differences">Differences Between WebGL and OpenGL ES 3.0</a> section.
142 <!-- ======================================================================================================= -->
144 <h2>Context Creation and Drawing Buffer Presentation</h2>
147 Before using the WebGL API, the author must obtain a <code>WebGLRenderingContext</code>
148 object for a given HTMLCanvasElement <a href="#refsCANVAS">[CANVAS]</a> as described
149 below. This object is used to manage OpenGL state and render to the drawing buffer, which
150 must be created at the time of context creation.
153 <!-- ======================================================================================================= -->
155 <h3>Context Creation</h3>
158 Each <code>WebGLRenderingContext</code> and <code>WebGL2RenderingContext</code> has an
159 associated <b><a name="context-canvas">canvas</a></b>, set upon creation, which is
160 a <em>canvas</em> <a href="#refsCANVAS">[CANVAS]</a>.
163 Each <code>WebGLRenderingContext</code> and <code>WebGL2RenderingContext</code> has <b><a name="context-creation-parameters">context
164 creation parameters</a></b>, set upon creation, in
165 a <a href="#WEBGLCONTEXTATTRIBUTES"><code>WebGLContextAttributes</code></a> object.
168 Each <code>WebGLRenderingContext</code> and <code>WebGL2RenderingContext</code> has <b><a name="actual-context-parameters">actual
169 context parameters</a></b>, set each time the drawing buffer is created, in
170 a <a href="#WEBGLCONTEXTATTRIBUTES"><code>WebGLContextAttributes</code></a> object.
173 Each <code>WebGLRenderingContext</code> and <code>WebGL2RenderingContext</code> has a <b><a name="webgl-context-lost-flag">webgl
174 context lost flag</a></b>, which is initially unset.
177 When the <code>getContext()</code> method of a <code>canvas</code> element is to return a
179 the <em>contextId</em> <code>webgl2</code> <a href="#refsCANVASCONTEXTS">[CANVASCONTEXTS]</a>,
180 the user agent must perform the following steps:
182 <ol class="nestedlist">
184 <li> Create a new <code>WebGL2RenderingContext</code> object, <em>context</em>.
186 <li> Let <em>context's</em> <a href="#context-canvas">canvas</a> be the canvas
187 the <code>getContext()</code> method is associated with.
189 <li> Create a new <code>WebGLContextAttributes</code> object, <em>contextAttributes</em>.
191 <li> If <code>getContext()</code> was invoked with a second argument, <em>options</em>, set
192 the attributes of <em>contextAttributes</em> from those specified in <em>options</em>.
194 <li> <a href="#create-a-drawing-buffer">Create a <em>drawing buffer</em></a> using the settings
195 specified in <em>contextAttributes</em>, and associate the <em>drawing buffer</em>
196 with <em>context</em>.
198 <li> If drawing buffer creation failed, perform the following steps:
200 <ol class="nestedlist">
202 <li> <a href="#fire-a-webgl-context-creation-error">Fire a WebGL context creation
203 error</a> at <em>canvas</em>.
205 <li> Return null and terminate these steps.
209 <li> Set the attributes of <em>contextAttributes</em> based on the properties of the newly
210 created drawing buffer.
212 <li> Set <em>context's</em> <a href="#context-creation-parameters">context creation
213 parameters</a> to <em>contextAttributes</em>.
215 <li> Return <em>context</em>.
220 <!-- ======================================================================================================= -->
222 <h2>DOM Interfaces</h2>
225 This section describes the interfaces and functionality added to the
226 DOM to support runtime access to the functionality described above.
229 <!-- ======================================================================================================= -->
234 The following types are introduced in WebGL 2.0.
237 typedef long long GLint64;
238 typedef unsigned long long GLuint64;
241 <!-- ======================================================================================================= -->
247 <pre class="idl">interface <dfn id="WebGLQuery">WebGLQuery</dfn> : WebGLObject {
250 <!-- ======================================================================================================= -->
252 <h3>WebGLSampler</h3>
256 <pre class="idl">interface <dfn id="WebGLSampler">WebGLSampler</dfn> : WebGLObject {
259 <!-- ======================================================================================================= -->
265 <pre class="idl">interface <dfn id="WebGLSync">WebGLSync</dfn> : WebGLObject {
268 <!-- ======================================================================================================= -->
270 <h3>WebGLTransformFeedback</h3>
274 <pre class="idl">interface <dfn id="WebGLTransformFeedback">WebGLTransformFeedback</dfn> : WebGLObject {
277 <!-- ======================================================================================================= -->
279 <h3>WebGLVertexArrayObject</h3>
283 <pre class="idl">interface <dfn id="WebGLVertexArrayObject">WebGLVertexArrayObject</dfn> : WebGLObject {
286 <!-- ======================================================================================================= -->
288 <h3><a name="WEBGLRENDERINGCONTEXT">The WebGL context</a></h3>
291 The <code>WebGL2RenderingContext</code> represents the API allowing
292 OpenGL ES 3.0 style rendering into the canvas element.
297 interface <dfn id="WebGL2RenderingContextBase">WebGL2RenderingContextBase</dfn>
299 const GLenum READ_BUFFER = 0x0C02;
300 const GLenum UNPACK_ROW_LENGTH = 0x0CF2;
301 const GLenum UNPACK_SKIP_ROWS = 0x0CF3;
302 const GLenum UNPACK_SKIP_PIXELS = 0x0CF4;
303 const GLenum PACK_ROW_LENGTH = 0x0D02;
304 const GLenum PACK_SKIP_ROWS = 0x0D03;
305 const GLenum PACK_SKIP_PIXELS = 0x0D04;
306 const GLenum COLOR = 0x1800;
307 const GLenum DEPTH = 0x1801;
308 const GLenum STENCIL = 0x1802;
309 const GLenum RED = 0x1903;
310 const GLenum RGB8 = 0x8051;
311 const GLenum RGBA8 = 0x8058;
312 const GLenum RGB10_A2 = 0x8059;
313 const GLenum TEXTURE_BINDING_3D = 0x806A;
314 const GLenum UNPACK_SKIP_IMAGES = 0x806D;
315 const GLenum UNPACK_IMAGE_HEIGHT = 0x806E;
316 const GLenum TEXTURE_3D = 0x806F;
317 const GLenum TEXTURE_WRAP_R = 0x8072;
318 const GLenum MAX_3D_TEXTURE_SIZE = 0x8073;
319 const GLenum UNSIGNED_INT_2_10_10_10_REV = 0x8368;
320 const GLenum MAX_ELEMENTS_VERTICES = 0x80E8;
321 const GLenum MAX_ELEMENTS_INDICES = 0x80E9;
322 const GLenum TEXTURE_MIN_LOD = 0x813A;
323 const GLenum TEXTURE_MAX_LOD = 0x813B;
324 const GLenum TEXTURE_BASE_LEVEL = 0x813C;
325 const GLenum TEXTURE_MAX_LEVEL = 0x813D;
326 const GLenum MIN = 0x8007;
327 const GLenum MAX = 0x8008;
328 const GLenum DEPTH_COMPONENT24 = 0x81A6;
329 const GLenum MAX_TEXTURE_LOD_BIAS = 0x84FD;
330 const GLenum TEXTURE_COMPARE_MODE = 0x884C;
331 const GLenum TEXTURE_COMPARE_FUNC = 0x884D;
332 const GLenum CURRENT_QUERY = 0x8865;
333 const GLenum QUERY_RESULT = 0x8866;
334 const GLenum QUERY_RESULT_AVAILABLE = 0x8867;
335 const GLenum BUFFER_MAPPED = 0x88BC; /* TODO: Depends on mapBufferRange */
336 const GLenum BUFFER_MAP_POINTER = 0x88BD; /* TODO: Depends on mapBufferRange */
337 const GLenum STREAM_READ = 0x88E1;
338 const GLenum STREAM_COPY = 0x88E2;
339 const GLenum STATIC_READ = 0x88E5;
340 const GLenum STATIC_COPY = 0x88E6;
341 const GLenum DYNAMIC_READ = 0x88E9;
342 const GLenum DYNAMIC_COPY = 0x88EA;
343 const GLenum MAX_DRAW_BUFFERS = 0x8824;
344 const GLenum DRAW_BUFFER0 = 0x8825;
345 const GLenum DRAW_BUFFER1 = 0x8826;
346 const GLenum DRAW_BUFFER2 = 0x8827;
347 const GLenum DRAW_BUFFER3 = 0x8828;
348 const GLenum DRAW_BUFFER4 = 0x8829;
349 const GLenum DRAW_BUFFER5 = 0x882A;
350 const GLenum DRAW_BUFFER6 = 0x882B;
351 const GLenum DRAW_BUFFER7 = 0x882C;
352 const GLenum DRAW_BUFFER8 = 0x882D;
353 const GLenum DRAW_BUFFER9 = 0x882E;
354 const GLenum DRAW_BUFFER10 = 0x882F;
355 const GLenum DRAW_BUFFER11 = 0x8830;
356 const GLenum DRAW_BUFFER12 = 0x8831;
357 const GLenum DRAW_BUFFER13 = 0x8832;
358 const GLenum DRAW_BUFFER14 = 0x8833;
359 const GLenum DRAW_BUFFER15 = 0x8834;
360 const GLenum MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49;
361 const GLenum MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A;
362 const GLenum SAMPLER_3D = 0x8B5F;
363 const GLenum SAMPLER_2D_SHADOW = 0x8B62;
364 const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B;
365 const GLenum PIXEL_PACK_BUFFER = 0x88EB;
366 const GLenum PIXEL_UNPACK_BUFFER = 0x88EC;
367 const GLenum PIXEL_PACK_BUFFER_BINDING = 0x88ED;
368 const GLenum PIXEL_UNPACK_BUFFER_BINDING = 0x88EF;
369 const GLenum FLOAT_MAT2x3 = 0x8B65;
370 const GLenum FLOAT_MAT2x4 = 0x8B66;
371 const GLenum FLOAT_MAT3x2 = 0x8B67;
372 const GLenum FLOAT_MAT3x4 = 0x8B68;
373 const GLenum FLOAT_MAT4x2 = 0x8B69;
374 const GLenum FLOAT_MAT4x3 = 0x8B6A;
375 const GLenum SRGB = 0x8C40;
376 const GLenum SRGB8 = 0x8C41;
377 const GLenum SRGB8_ALPHA8 = 0x8C43;
378 const GLenum COMPARE_REF_TO_TEXTURE = 0x884E;
379 const GLenum RGBA32F = 0x8814;
380 const GLenum RGB32F = 0x8815;
381 const GLenum RGBA16F = 0x881A;
382 const GLenum RGB16F = 0x881B;
383 const GLenum VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD;
384 const GLenum MAX_ARRAY_TEXTURE_LAYERS = 0x88FF;
385 const GLenum MIN_PROGRAM_TEXEL_OFFSET = 0x8904;
386 const GLenum MAX_PROGRAM_TEXEL_OFFSET = 0x8905;
387 const GLenum MAX_VARYING_COMPONENTS = 0x8B4B;
388 const GLenum TEXTURE_2D_ARRAY = 0x8C1A;
389 const GLenum TEXTURE_BINDING_2D_ARRAY = 0x8C1D;
390 const GLenum R11F_G11F_B10F = 0x8C3A;
391 const GLenum UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B;
392 const GLenum RGB9_E5 = 0x8C3D;
393 const GLenum UNSIGNED_INT_5_9_9_9_REV = 0x8C3E;
394 const GLenum TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 0x8C76;
395 const GLenum TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F;
396 const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80;
397 const GLenum TRANSFORM_FEEDBACK_VARYINGS = 0x8C83;
398 const GLenum TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84;
399 const GLenum TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85;
400 const GLenum TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88;
401 const GLenum RASTERIZER_DISCARD = 0x8C89;
402 const GLenum MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A;
403 const GLenum MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B;
404 const GLenum INTERLEAVED_ATTRIBS = 0x8C8C;
405 const GLenum SEPARATE_ATTRIBS = 0x8C8D;
406 const GLenum TRANSFORM_FEEDBACK_BUFFER = 0x8C8E;
407 const GLenum TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F;
408 const GLenum RGBA32UI = 0x8D70;
409 const GLenum RGB32UI = 0x8D71;
410 const GLenum RGBA16UI = 0x8D76;
411 const GLenum RGB16UI = 0x8D77;
412 const GLenum RGBA8UI = 0x8D7C;
413 const GLenum RGB8UI = 0x8D7D;
414 const GLenum RGBA32I = 0x8D82;
415 const GLenum RGB32I = 0x8D83;
416 const GLenum RGBA16I = 0x8D88;
417 const GLenum RGB16I = 0x8D89;
418 const GLenum RGBA8I = 0x8D8E;
419 const GLenum RGB8I = 0x8D8F;
420 const GLenum RED_INTEGER = 0x8D94;
421 const GLenum RGB_INTEGER = 0x8D98;
422 const GLenum RGBA_INTEGER = 0x8D99;
423 const GLenum SAMPLER_2D_ARRAY = 0x8DC1;
424 const GLenum SAMPLER_2D_ARRAY_SHADOW = 0x8DC4;
425 const GLenum SAMPLER_CUBE_SHADOW = 0x8DC5;
426 const GLenum UNSIGNED_INT_VEC2 = 0x8DC6;
427 const GLenum UNSIGNED_INT_VEC3 = 0x8DC7;
428 const GLenum UNSIGNED_INT_VEC4 = 0x8DC8;
429 const GLenum INT_SAMPLER_2D = 0x8DCA;
430 const GLenum INT_SAMPLER_3D = 0x8DCB;
431 const GLenum INT_SAMPLER_CUBE = 0x8DCC;
432 const GLenum INT_SAMPLER_2D_ARRAY = 0x8DCF;
433 const GLenum UNSIGNED_INT_SAMPLER_2D = 0x8DD2;
434 const GLenum UNSIGNED_INT_SAMPLER_3D = 0x8DD3;
435 const GLenum UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4;
436 const GLenum UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7;
437 // const GLenum BUFFER_ACCESS_FLAGS = 0x911F; /* TODO: Depends on mapBufferRange */
438 // const GLenum BUFFER_MAP_LENGTH = 0x9120; /* TODO: Depends on mapBufferRange */
439 // const GLenum BUFFER_MAP_OFFSET = 0x9121; /* TODO: Depends on mapBufferRange */
440 const GLenum DEPTH_COMPONENT32F = 0x8CAC;
441 const GLenum DEPTH32F_STENCIL8 = 0x8CAD;
442 const GLenum FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD;
443 const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210;
444 const GLenum FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211;
445 const GLenum FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212;
446 const GLenum FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213;
447 const GLenum FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214;
448 const GLenum FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215;
449 const GLenum FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216;
450 const GLenum FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217;
451 const GLenum FRAMEBUFFER_DEFAULT = 0x8218;
452 const GLenum FRAMEBUFFER_UNDEFINED = 0x8219;
453 const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A;
454 const GLenum DEPTH_STENCIL = 0x84F9;
455 const GLenum UNSIGNED_INT_24_8 = 0x84FA;
456 const GLenum DEPTH24_STENCIL8 = 0x88F0;
457 const GLenum UNSIGNED_NORMALIZED = 0x8C17;
458 const GLenum DRAW_FRAMEBUFFER_BINDING = 0x8CA6; /* Same as FRAMEBUFFER_BINDING */
459 const GLenum READ_FRAMEBUFFER = 0x8CA8;
460 const GLenum DRAW_FRAMEBUFFER = 0x8CA9;
461 const GLenum READ_FRAMEBUFFER_BINDING = 0x8CAA;
462 const GLenum RENDERBUFFER_SAMPLES = 0x8CAB;
463 const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4;
464 const GLenum MAX_COLOR_ATTACHMENTS = 0x8CDF;
465 const GLenum COLOR_ATTACHMENT1 = 0x8CE1;
466 const GLenum COLOR_ATTACHMENT2 = 0x8CE2;
467 const GLenum COLOR_ATTACHMENT3 = 0x8CE3;
468 const GLenum COLOR_ATTACHMENT4 = 0x8CE4;
469 const GLenum COLOR_ATTACHMENT5 = 0x8CE5;
470 const GLenum COLOR_ATTACHMENT6 = 0x8CE6;
471 const GLenum COLOR_ATTACHMENT7 = 0x8CE7;
472 const GLenum COLOR_ATTACHMENT8 = 0x8CE8;
473 const GLenum COLOR_ATTACHMENT9 = 0x8CE9;
474 const GLenum COLOR_ATTACHMENT10 = 0x8CEA;
475 const GLenum COLOR_ATTACHMENT11 = 0x8CEB;
476 const GLenum COLOR_ATTACHMENT12 = 0x8CEC;
477 const GLenum COLOR_ATTACHMENT13 = 0x8CED;
478 const GLenum COLOR_ATTACHMENT14 = 0x8CEE;
479 const GLenum COLOR_ATTACHMENT15 = 0x8CEF;
480 const GLenum FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56;
481 const GLenum MAX_SAMPLES = 0x8D57;
482 const GLenum HALF_FLOAT = 0x140B;
483 // const GLenum MAP_READ_BIT = 0x0001; /* TODO: Depends on mapBufferRange */
484 // const GLenum MAP_WRITE_BIT = 0x0002; /* TODO: Depends on mapBufferRange */
485 // const GLenum MAP_INVALIDATE_RANGE_BIT = 0x0004; /* TODO: Depends on mapBufferRange */
486 // const GLenum MAP_INVALIDATE_BUFFER_BIT = 0x0008; /* TODO: Depends on mapBufferRange */
487 // const GLenum MAP_FLUSH_EXPLICIT_BIT = 0x0010; /* TODO: Depends on mapBufferRange */
488 // const GLenum MAP_UNSYNCHRONIZED_BIT = 0x0020; /* TODO: Depends on mapBufferRange */
489 const GLenum RG = 0x8227;
490 const GLenum RG_INTEGER = 0x8228;
491 const GLenum R8 = 0x8229;
492 const GLenum RG8 = 0x822B;
493 const GLenum R16F = 0x822D;
494 const GLenum R32F = 0x822E;
495 const GLenum RG16F = 0x822F;
496 const GLenum RG32F = 0x8230;
497 const GLenum R8I = 0x8231;
498 const GLenum R8UI = 0x8232;
499 const GLenum R16I = 0x8233;
500 const GLenum R16UI = 0x8234;
501 const GLenum R32I = 0x8235;
502 const GLenum R32UI = 0x8236;
503 const GLenum RG8I = 0x8237;
504 const GLenum RG8UI = 0x8238;
505 const GLenum RG16I = 0x8239;
506 const GLenum RG16UI = 0x823A;
507 const GLenum RG32I = 0x823B;
508 const GLenum RG32UI = 0x823C;
509 const GLenum VERTEX_ARRAY_BINDING = 0x85B5;
510 const GLenum R8_SNORM = 0x8F94;
511 const GLenum RG8_SNORM = 0x8F95;
512 const GLenum RGB8_SNORM = 0x8F96;
513 const GLenum RGBA8_SNORM = 0x8F97;
514 const GLenum SIGNED_NORMALIZED = 0x8F9C;
515 const GLenum PRIMITIVE_RESTART_FIXED_INDEX = 0x8D69;
516 const GLenum COPY_READ_BUFFER = 0x8F36;
517 const GLenum COPY_WRITE_BUFFER = 0x8F37;
518 const GLenum COPY_READ_BUFFER_BINDING = 0x8F36; /* Same as COPY_READ_BUFFER */
519 const GLenum COPY_WRITE_BUFFER_BINDING = 0x8F37; /* Same as COPY_WRITE_BUFFER */
520 const GLenum UNIFORM_BUFFER = 0x8A11;
521 const GLenum UNIFORM_BUFFER_BINDING = 0x8A28;
522 const GLenum UNIFORM_BUFFER_START = 0x8A29;
523 const GLenum UNIFORM_BUFFER_SIZE = 0x8A2A;
524 const GLenum MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B;
525 const GLenum MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D;
526 const GLenum MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E;
527 const GLenum MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F;
528 const GLenum MAX_UNIFORM_BLOCK_SIZE = 0x8A30;
529 const GLenum MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31;
530 const GLenum MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33;
531 const GLenum UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34;
532 const GLenum ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 0x8A35;
533 const GLenum ACTIVE_UNIFORM_BLOCKS = 0x8A36;
534 const GLenum UNIFORM_TYPE = 0x8A37;
535 const GLenum UNIFORM_SIZE = 0x8A38;
536 const GLenum UNIFORM_NAME_LENGTH = 0x8A39;
537 const GLenum UNIFORM_BLOCK_INDEX = 0x8A3A;
538 const GLenum UNIFORM_OFFSET = 0x8A3B;
539 const GLenum UNIFORM_ARRAY_STRIDE = 0x8A3C;
540 const GLenum UNIFORM_MATRIX_STRIDE = 0x8A3D;
541 const GLenum UNIFORM_IS_ROW_MAJOR = 0x8A3E;
542 const GLenum UNIFORM_BLOCK_BINDING = 0x8A3F;
543 const GLenum UNIFORM_BLOCK_DATA_SIZE = 0x8A40;
544 const GLenum UNIFORM_BLOCK_NAME_LENGTH = 0x8A41;
545 const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42;
546 const GLenum UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43;
547 const GLenum UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44;
548 const GLenum UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46;
549 const GLenum INVALID_INDEX = 0xFFFFFFFF;
550 const GLenum MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122;
551 const GLenum MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125;
552 const GLenum MAX_SERVER_WAIT_TIMEOUT = 0x9111;
553 const GLenum OBJECT_TYPE = 0x9112;
554 const GLenum SYNC_CONDITION = 0x9113;
555 const GLenum SYNC_STATUS = 0x9114;
556 const GLenum SYNC_FLAGS = 0x9115;
557 const GLenum SYNC_FENCE = 0x9116;
558 const GLenum SYNC_GPU_COMMANDS_COMPLETE = 0x9117;
559 const GLenum UNSIGNALED = 0x9118;
560 const GLenum SIGNALED = 0x9119;
561 const GLenum ALREADY_SIGNALED = 0x911A;
562 const GLenum TIMEOUT_EXPIRED = 0x911B;
563 const GLenum CONDITION_SATISFIED = 0x911C;
564 const GLenum WAIT_FAILED = 0x911D;
565 const GLenum SYNC_FLUSH_COMMANDS_BIT = 0x00000001;
566 const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE;
567 const GLenum ANY_SAMPLES_PASSED = 0x8C2F;
568 const GLenum ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A;
569 const GLenum SAMPLER_BINDING = 0x8919;
570 const GLenum RGB10_A2UI = 0x906F;
571 const GLenum TEXTURE_SWIZZLE_R = 0x8E42;
572 const GLenum TEXTURE_SWIZZLE_G = 0x8E43;
573 const GLenum TEXTURE_SWIZZLE_B = 0x8E44;
574 const GLenum TEXTURE_SWIZZLE_A = 0x8E45;
575 const GLenum GREEN = 0x1904;
576 const GLenum BLUE = 0x1905;
577 const GLenum INT_2_10_10_10_REV = 0x8D9F;
578 const GLenum TRANSFORM_FEEDBACK = 0x8E22;
579 const GLenum TRANSFORM_FEEDBACK_PAUSED = 0x8E23;
580 const GLenum TRANSFORM_FEEDBACK_ACTIVE = 0x8E24;
581 const GLenum TRANSFORM_FEEDBACK_BINDING = 0x8E25;
582 const GLenum COMPRESSED_R11_EAC = 0x9270;
583 const GLenum COMPRESSED_SIGNED_R11_EAC = 0x9271;
584 const GLenum COMPRESSED_RG11_EAC = 0x9272;
585 const GLenum COMPRESSED_SIGNED_RG11_EAC = 0x9273;
586 const GLenum COMPRESSED_RGB8_ETC2 = 0x9274;
587 const GLenum COMPRESSED_SRGB8_ETC2 = 0x9275;
588 const GLenum COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276;
589 const GLenum COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277;
590 const GLenum COMPRESSED_RGBA8_ETC2_EAC = 0x9278;
591 const GLenum COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279;
592 const GLenum TEXTURE_IMMUTABLE_FORMAT = 0x912F;
593 const GLenum MAX_ELEMENT_INDEX = 0x8D6B;
594 const GLenum NUM_SAMPLE_COUNTS = 0x9380;
595 const GLenum TEXTURE_IMMUTABLE_LEVELS = 0x82DF;
597 const GLuint64 TIMEOUT_IGNORED = 0xFFFFFFFFFFFFFFFF;
600 void copyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
602 /* Framebuffer objects */
603 void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
604 void framebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
605 any getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname);
606 void invalidateFramebuffer(GLenum target, sequence<GLenum> attachments);
607 void invalidateSubFramebuffer (GLenum target, sequence<GLenum> attachments, GLint x, GLint y, GLsizei width, GLsizei height);
608 void readBuffer(GLenum mode);
609 void renderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
611 /* Texture objects */
612 void texStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height);
613 void texStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth);
614 void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, ArrayBufferView? pixels);
615 void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, ImageData? data);
616 void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, HTMLImageElement image);
617 void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, HTMLCanvasElement canvas);
618 void texSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, HTMLVideoElement video);
619 void copyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height);
620 void compressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, ArrayBufferView data);
621 void compressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, ArrayBufferView data);
623 /* Programs and shaders */
624 [WebGLHandlesContextLoss] GLint getFragDataLocation(WebGLProgram? program, DOMString name);
626 /* Uniforms and attributes */
627 void vertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, GLintptr offset);
629 /* TODO: these will have to be exposed differently -- for example,
630 by changing the return type of getVertexAttrib based on the
631 most recently set type for the vertex attrib */
632 // void glGetVertexAttribIiv(GLuint index, GLenum pname, GLint* params);
633 // void glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint* params);
635 void uniform1ui(WebGLUniformLocation? location, GLuint v0);
636 void uniform2ui(WebGLUniformLocation? location, GLuint v0, GLuint v1);
637 void uniform3ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2);
638 void uniform4ui(WebGLUniformLocation? location, GLuint v0, GLuint v1, GLuint v2, GLuint v3);
639 void uniform1uiv(WebGLUniformLocation? location, sequence<GLuint> value);
640 void uniform2uiv(WebGLUniformLocation? location, sequence<GLuint> value);
641 void uniform3uiv(WebGLUniformLocation? location, sequence<GLuint> value);
642 void uniform4uiv(WebGLUniformLocation? location, sequence<GLuint> value);
643 void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
644 void uniformMatrix2x3fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value);
645 void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
646 void uniformMatrix3x2fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value);
647 void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
648 void uniformMatrix2x4fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value);
649 void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
650 void uniformMatrix4x2fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value);
651 void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
652 void uniformMatrix3x4fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value);
653 void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, Float32Array value);
654 void uniformMatrix4x3fv(WebGLUniformLocation? location, GLboolean transpose, sequence<GLfloat> value);
655 /* TODO: this will be exposed as a couple of additional entries in
656 the return type table for getUniform */
657 // void glGetUniformuiv (GLuint program, GLint location, GLuint* params);
658 void vertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w);
659 void vertexAttribI4iv(GLuint index, sequence<GLint> v);
660 void vertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w);
661 void vertexAttribI4uiv(GLuint index, sequence<GLuint> v);
663 /* Writing to the drawing buffer */
664 void vertexAttribDivisor(GLuint index, GLuint divisor);
665 void drawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instanceCount);
666 void drawElementsInstanced(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei instanceCount);
667 /* TODO(kbr): argue against exposing this because it can't safely
668 offer better performance than drawElements */
669 void drawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLintptr offset);
671 /* Multiple Render Targets */
672 void drawBuffers(sequence<GLenum> buffers);
673 void clearBufferiv(GLenum buffer, GLint drawbuffer, Int32Array value);
674 void clearBufferiv(GLenum buffer, GLint drawbuffer, sequence<GLint> value);
675 void clearBufferuiv(GLenum buffer, GLint drawbuffer, Uint32Array value);
676 void clearBufferuiv(GLenum buffer, GLint drawbuffer, sequence<GLuint> value);
677 void clearBufferfv(GLenum buffer, GLint drawbuffer, Float32Array value);
678 void clearBufferfv(GLenum buffer, GLint drawbuffer, sequence<GLfloat> value);
679 void clearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil);
682 WebGLQuery? createQuery();
683 void deleteQuery(WebGLQuery? query);
684 [WebGLHandlesContextLoss] GLboolean isQuery(WebGLQuery? query);
685 void beginQuery(GLenum target, WebGLQuery? query);
686 void endQuery(GLenum target);
687 /* TODO: document return type */
688 any getQuery(GLenum target, GLenum pname);
689 /* TODO: document return type */
690 any getQueryParameter(WebGLQuery? query, GLenum pname);
692 /* Sampler Objects */
693 WebGLSampler? createSampler();
694 void deleteSampler(WebGLSampler? sampler);
695 [WebGLHandlesContextLoss] GLboolean isSampler(WebGLSampler? sampler);
696 void bindSampler(GLuint unit, WebGLSampler? sampler);
697 void samplerParameteri(WebGLSampler? sampler, GLenum pname, GLint param);
698 void samplerParameteriv(WebGLSampler? sampler, GLenum pname, Int32Array param);
699 void samplerParameteriv(WebGLSampler? sampler, GLenum pname, sequence<GLint> param);
700 void samplerParameterf(WebGLSampler? sampler, GLenum pname, GLfloat param);
701 void samplerParameterfv(WebGLSampler? sampler, GLenum pname, Float32Array param);
702 void samplerParameterfv(WebGLSampler? sampler, GLenum pname, sequence<GLfloat> param);
704 /* TODO: document return type */
705 any getSamplerParameter(WebGLSampler? sampler, GLenum pname);
708 WebGLSync? fenceSync(GLenum condition, GLbitfield flags);
709 GLboolean isSync(WebGLSync? sync);
710 void deleteSync(WebGLSync? sync);
711 GLenum clientWaitSync(WebGLSync? sync, GLbitfield flags, GLuint64 timeout);
712 void waitSync(WebGLSync? sync, GLbitfield flags, GLuint64 timeout);
713 /* TODO: document return type */
714 any getSyncParameter(WebGLSync? sync, GLenum pname);
716 /* Transform Feedback */
717 WebGLTransformFeedback? createTransformFeedback();
718 void deleteTransformFeedback(WebGLTransformFeedback?);
719 [WebGLHandlesContextLoss] GLboolean isTransformFeedback(WebGLTransformFeedback?);
720 void bindTransformFeedback (GLenum target, GLuint id);
721 void beginTransformFeedback(GLenum primitiveMode);
722 void endTransformFeedback();
723 void transformFeedbackVaryings(WebGLProgram? program, GLsizei count, sequence<DOMString> varyings, GLenum bufferMode);
724 WebGLActiveInfo? getTransformFeedbackVarying(WebGLProgram? program, GLuint index);
725 void pauseTransformFeedback();
726 void resumeTransformFeedback();
728 /* Uniform Buffer Objects and Transform Feedback Buffers */
729 void bindBufferBase(GLenum target, GLuint index, WebGLBuffer? buffer);
730 void bindBufferRange(GLenum target, GLuint index, WebGLBuffer? buffer, GLintptr offset, GLsizeiptr size);
731 any getIndexedParameter(GLenum target, GLuint index);
732 sequence<GLuint>? getUniformIndices(WebGLProgram? program, sequence<DOMString> uniformNames);
733 sequence<GLint>? getActiveUniforms(WebGLProgram? program, sequence<GLuint> uniformIndices, GLenum pname);
734 GLuint getUniformBlockIndex(WebGLProgram? program, DOMString uniformBlockName);
735 /* TODO: document return type; make sure unnecessary enums are deleted */
736 any getActiveUniformBlockParameter(WebGLProgram? program, GLuint uniformBlockIndex, GLenum pname);
737 /* TODO: if there were a fake enum for GL_UNIFORM_BLOCK_NAME, then this could be folded into getActiveUniformBlockParameter */
738 DOMString? getActiveUniformBlockName(WebGLProgram? program, GLuint uniformBlockIndex);
739 void uniformBlockBinding(WebGLProgram? program, GLuint uniformBlockIndex, GLuint uniformBlockBinding);
741 /* Vertex Array Objects */
742 WebGLVertexArrayObject? createVertexArray();
743 void deleteVertexArray(WebGLVertexArrayObject? vertexArray);
744 [WebGLHandlesContextLoss] GLboolean isVertexArray(WebGLVertexArrayObject? vertexArray);
745 void bindVertexArray(WebGLVertexArrayObject? array);
748 * - Consider adding getBufferSubData replacing MapBufferRange, etc.
749 * - Figure out what to do about glMapBufferRange, glFlushMappedBufferRange, glUnmapBuffer
750 * - If exposing these, think about glGetBufferPointerv
751 * - Is it necessary to expose glGetInteger64v, glGetInteger64i_v, and glGetBufferParameteri64v?
752 * - Or are they subsumed into other queries' signatures?
753 * - Deliberately not exposing glGetProgramBinary, glProgramBinary, glProgramParameteri
756 WebGL2RenderingContextBase implements WebGLRenderingContextBase;
758 interface <dfn id="WebGL2RenderingContext">WebGL2RenderingContext</dfn>
761 WebGL2RenderingContext implements WebGL2RenderingContextBase;
765 <!-- ======================================================================================================= -->
767 <h4>Setting and getting state</h4>
770 <dt class="idl-code"><a name="GETPARAMETER">any getParameter</a>(GLenum pname)
771 <a class="gl-spec" href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glGet.xml">
772 (glGet OpenGL ES 3.0 man page)
774 <a class="gl-spec" href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glGetString.xml">
775 (glGetString OpenGL ES 3.0 man page)
778 Return the value for the passed pname. As well as supporting all
779 the pname/type values from WebGL 1.0, the following parameters are supported:
781 <tr><th>pname</th><th>returned type</th></tr>
782 <tr><td>COPY_READ_BUFFER_BINDING</td><td>WebGLBuffer</td></tr>
783 <tr><td>COPY_WRITE_BUFFER_BINDING</td><td>WebGLBuffer</td></tr>
784 <tr><td>DRAW_BINDING</td><td>GLenum</td></tr>
785 <tr><td>DRAW_FRAMEBUFFER_BINDING</td><td>WebGLFramebuffer</td></tr>
786 <tr><td>FRAGMENT_SHADER_DERIVATIVE_HINT</td><td>GLenum</td></tr>
787 <tr><td>IMPLEMENTATION_COLOR_READ_FORMAT</td><td>GLenum</td></tr>
788 <tr><td>IMPLEMENTATION_COLOR_READ_TYPE</td><td>GLenum</td></tr>
789 <tr><td>MAX_3D_TEXTURE_SIZE</td><td>GLint</td></tr>
790 <tr><td>MAX_ARRAY_TEXTURE_LAYERS</td><td>GLint</td></tr>
791 <tr><td>MAX_COLOR_ATTACHMENTS</td><td>GLint</td></tr>
792 <tr><td>MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS</td><td>GLint</td></tr>
793 <tr><td>MAX_COMBINED_UNIFORM_BLOCKS</td><td>GLint</td></tr>
794 <tr><td>MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS</td><td>GLint</td></tr>
795 <tr><td>MAX_DRAW_BUFFERS</td><td>GLint</td></tr>
796 <tr><td>MAX_ELEMENT_INDEX</td><td>GLint</td></tr>
797 <tr><td>MAX_ELEMENTS_INDICES</td><td>GLint</td></tr>
798 <tr><td>MAX_ELEMENTS_VERTICES</td><td>GLint</td></tr>
799 <tr><td>MAX_FRAGMENT_INPUT_COMPONENTS</td><td>GLint</td></tr>
800 <tr><td>MAX_FRAGMENT_UNIFORM_BLOCKS</td><td>GLint</td></tr>
801 <tr><td>MAX_FRAGMENT_UNIFORM_COMPONENTS</td><td>GLint</td></tr>
802 <tr><td>MAX_PROGRAM_TEXEL_OFFSET</td><td>GLint</td></tr>
803 <tr><td>MAX_SAMPLES</td><td>GLint</td></tr>
804 <tr><td>MAX_SERVER_WAIT_TIMEOUT</td><td>GLuint64</td></tr>
805 <tr><td>MAX_TEXTURE_LOD_BIAS</td><td>GLint</td></tr>
806 <tr><td>MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS</td><td>GLint</td></tr>
807 <tr><td>MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS</td><td>GLint</td></tr>
808 <tr><td>MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS</td><td>GLint</td></tr>
809 <tr><td>MAX_UNIFORM_BLOCK_SIZE</td><td>GLint</td></tr>
810 <tr><td>MAX_UNIFORM_BUFFER_BINDINGS</td><td>GLint</td></tr>
811 <tr><td>MAX_VARYING_COMPONENTS</td><td>GLint</td></tr>
812 <tr><td>MAX_VERTEX_OUTPUT_COMPONENTS</td><td>GLint</td></tr>
813 <tr><td>MAX_VERTEX_UNIFORM_BLOCKS</td><td>GLint</td></tr>
814 <tr><td>MAX_VERTEX_UNIFORM_COMPONENTS</td><td>GLint</td></tr>
815 <tr><td>MIN_PROGRAM_TEXEL_OFFSET</td><td>GLint</td></tr>
816 <tr><td>PACK_IMAGE_HEIGHT</td><td>GLint</td></tr>
817 <tr><td>PACK_ROW_LENGTH</td><td>GLint</td></tr>
818 <tr><td>PACK_SKIP_IMAGES</td><td>GLint</td></tr>
819 <tr><td>PACK_SKIP_PIXELS</td><td>GLint</td></tr>
820 <tr><td>PACK_SKIP_ROWS</td><td>GLint</td></tr>
821 <tr><td>PIXEL_PACK_BUFFER_BINDING</td><td>WebGLBuffer</td></tr>
822 <tr><td>PIXEL_UNPACK_BUFFER_BINDING</td><td>WebGLBuffer</td></tr>
823 <tr><td>PRIMITIVE_RESTART_FIXED_INDEX</td><td>GLboolean</td></tr>
824 <tr><td>READ_BUFFER</td><td>GLenum</td></tr>
825 <tr><td>READ_FRAMEBUFFER_BINDING</td><td>WebGLFramebuffer</td></tr>
826 <tr><td>SAMPLE_ALPHA_TO_COVERAGE</td><td>GLboolean</td></tr>
827 <tr><td>SAMPLE_COVERAGE</td><td>GLboolean</td></tr>
828 <tr><td>SAMPLER_BINDING</td><td>WebGLSampler</td></tr>
829 <tr><td>TEXTURE_BINDING_2D_ARRAY</td><td>WebGLTexture</td></tr>
830 <tr><td>TEXTURE_BINDING_3D</td><td>WebGLTexture</td></tr>
831 <tr><td>TRANSFORM_FEEDBACK_ACTIVE</td><td>GLboolean</td></tr>
832 <tr><td>TRANSFORM_FEEDBACK_BUFFER_BINDING</td><td>WebGLBuffer</td></tr>
833 <tr><td>TRANSFORM_FEEDBACK_PAUSED</td><td>GLboolean</td></tr>
834 <tr><td>TRANSFORM_FEEDBACK_BUFFER_SIZE</td><td>GLint</td></tr>
835 <tr><td>TRANSFORM_FEEDBACK_BUFFER_START</td><td>GLint</td></tr>
836 <tr><td>UNIFORM_BUFFER_BINDING</td><td>WebGLBuffer</td></tr>
837 <tr><td>UNIFORM_BUFFER_OFFSET_ALIGNMENT</td><td>GLint</td></tr>
838 <tr><td>UNIFORM_BUFFER_SIZE</td><td>GLint</td></tr>
839 <tr><td>UNIFORM_BUFFER_START</td><td>GLint</td></tr>
840 <tr><td>UNPACK_IMAGE_HEIGHT</td><td>GLint</td></tr>
841 <tr><td>UNPACK_ROW_LENGTH</td><td>GLint</td></tr>
842 <tr><td>UNPACK_SKIP_IMAGES</td><td>GLboolean</td></tr>
843 <tr><td>UNPACK_SKIP_PIXELS</td><td>GLboolean</td></tr>
844 <tr><td>UNPACK_SKIP_ROWS</td><td>GLboolean</td></tr>
845 <tr><td>VERTEX_ARRAY_BINDING</td><td>WebGLVertexArrayObject</td></tr>
849 <!-- ======================================================================================================= -->
851 <h4>Buffer objects</h4>
857 <span class="gl-spec">
858 (<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf#nameddest=section-2.9.5">OpenGL ES 3.0 §2.9.5</a>,
859 <a href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glCopyBufferSubData.xml" class="nonnormative">man page</a>)
865 <p class="idl-code">void copyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size);
866 <span class="gl-spec">
867 (<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf#nameddest=section-2.9.5">OpenGL ES 3.0.2 §2.9.5</a>,
868 <a href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glCopyBufferSubData.xml" class="nonnormative">man page</a>)
874 <!-- ======================================================================================================= -->
876 <h4>Framebuffer objects</h4>
879 <dt class="idl-code">any getFramebufferAttachmentParameter(GLenum target, GLenum attachment,
881 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf#nameddest=section-6.1.13">OpenGL ES 3.0.2 §6.1.13</a>, similar to <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/docs/man/xhtml/glGetFramebufferAttachmentParameteriv.xml">glGetFramebufferAttachmentParameteriv</a>)</span>
884 Return the value for the passed pname given the passed target and attachment. The type
885 returned is the natural type for the requested pname, as given in the following table:
887 <tr><th>pname</th><th>returned type</th></tr>
888 <tr><td>FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE</td><td>GLint</td></tr>
889 <tr><td>FRAMEBUFFER_ATTACHMENT_BLUE_SIZE</td><td>GLint</td></tr>
890 <tr><td>FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING</td><td>Genum</td></tr>
891 <tr><td>FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE</td><td>Genum</td></tr>
892 <tr><td>FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE</td><td>GLint</td></tr>
893 <tr><td>FRAMEBUFFER_ATTACHMENT_GREEN_SIZE</td><td>GLint</td></tr>
894 <tr><td>FRAMEBUFFER_ATTACHMENT_OBJECT_NAME</td><td>WebGLRenderbuffer or WebGLTexture</td></tr>
895 <tr><td>FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE</td><td>GLenum</td></tr>
896 <tr><td>FRAMEBUFFER_ATTACHMENT_RED_SIZE</td><td>GLint</td></tr>
897 <tr><td>FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE</td><td>GLint</td></tr>
898 <tr><td>FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE</td><td>GLint</td></tr>
899 <tr><td>FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER</td><td>Gint</td></tr>
900 <tr><td>FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL</td><td>GLint</td></tr>
902 <p>If <em>pname</em> is not in the table above, generates an <code>INVALID_ENUM</code> error.</p>
903 <p>If an OpenGL error is generated, returns null.</p>
906 <p class="idl-code">void blitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter);
907 <span class="gl-spec">
908 (<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf#nameddest=section-4.3.2">OpenGL ES 3.0.2 §4.3.2</a>,
909 <a href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glBlitFramebuffer.xml" class="nonnormative">man page</a>)
914 <p class="idl-code">void framebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer);
915 <span class="gl-spec">
916 (<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf#nameddest=section-4.4">OpenGL ES 3.0.2 §4.4</a>,
917 <a href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glFramebufferTextureLayer.xml" class="nonnormative">man page</a>)
922 <p class="idl-code">any getInternalformatParameter(GLenum target, GLenum internalformat, GLenum pname);
923 <span class="gl-spec">
924 (<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf#nameddest=section-6.1.15">OpenGL ES 3.0.2 §6.1.15</a>,
925 <a href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glGetInternalformativ.xml" class="nonnormative">man page</a>)
930 <p class="idl-code">void invalidateFramebuffer(GLenum target, sequence<GLenum> attachments);
931 <span class="gl-spec">
932 (<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf#nameddest=section-4.5">OpenGL ES 3.0.2 §4.5</a>,
933 <a href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glInvalidateFramebuffer.xml" class="nonnormative">man page</a>)
938 <p class="idl-code">void invalidateSubFramebuffer (GLenum target, sequence<GLenum> attachments, GLint x, GLint y, GLsizei width, GLsizei height);
939 <span class="gl-spec">
940 (<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf#nameddest=section-4.5">OpenGL ES 3.0.2 §4.5</a>,
941 <a href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glInvalidateSubFramebuffer.xml" class="nonnormative">man page</a>)
946 <p class="idl-code">void readBuffer(GLenum mode);
947 <span class="gl-spec">
948 (<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf#nameddest=section-4.3.1">OpenGL ES 3.0.2 §4.3.1</a>,
949 <a href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glReadBuffer.xml" class="nonnormative">man page</a>)
955 <!-- ======================================================================================================= -->
957 <h4>Renderbuffer objects</h4>
960 <dt class="idl-code">any getRenderbufferParameter(GLenum target, GLenum pname)
961 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf#nameddest=section-6.1.14">OpenGL ES 2.0 §6.1.14</a>, similar to <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glGetRenderbufferParameteriv.xml">glGetRenderbufferParameteriv</a>)</span>
964 Return the value for the passed pname given the passed target. The type returned is the natural
965 type for the requested pname, as given in the following table:
967 <tr><th>pname</th><th>returned type</th></tr>
968 <tr><td>RENDERBUFFER_WIDTH</td><td>GLint</td></tr>
969 <tr><td>RENDERBUFFER_HEIGHT</td><td>GLint</td></tr>
970 <tr><td>RENDERBUFFER_INTERNAL_FORMAT</td><td>GLenum</td></tr>
971 <tr><td>RENDERBUFFER_RED_SIZE</td><td>GLint</td></tr>
972 <tr><td>RENDERBUFFER_GREEN_SIZE</td><td>GLint</td></tr>
973 <tr><td>RENDERBUFFER_BLUE_SIZE</td><td>GLint</td></tr>
974 <tr><td>RENDERBUFFER_ALPHA_SIZE</td><td>GLint</td></tr>
975 <tr><td>RENDERBUFFER_DEPTH_SIZE</td><td>GLint</td></tr>
976 <tr><td>RENDERBUFFER_SAMPLES</td><td>GLint</td></tr>
977 <tr><td>RENDERBUFFER_STENCIL_SIZE</td><td>GLint</td></tr>
979 <p>If <em>pname</em> is not in the table above, generates an <code>INVALID_ENUM</code> error.</p>
980 <p>If an OpenGL error is generated, returns null.</p>
983 <p class="idl-code">void renderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height);
984 <span class="gl-spec">
985 (<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf#nameddest=section-4.4.2">OpenGL ES 3.0.2 §4.4.2</a>,
986 <a href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glRenderBufferStorageMultisample.xml" class="nonnormative">man page</a>)
992 <!-- ======================================================================================================= -->
994 <h4>Texture objects</h4>
997 <dt class="idl-code">any getTexParameter(GLenum target, GLenum pname)
998 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf#nameddest=section-6.1.3">OpenGL ES 3.0.2 §6.1.3</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glGetTexParameter.xml">man page</a>)</span>
1001 Return the value for the passed pname given the passed target. The type returned is the natural type for the
1002 requested pname, as given in the following table:
1004 <tr><th>pname</th><th>returned type</th></tr>
1005 <tr><td>TEXTURE_BASE_LEVEL</td><td>GLint</td></tr>
1006 <tr><td>TEXTURE_COMPARE_FUNC</td><td>GLenum</td></tr>
1007 <tr><td>TEXTURE_COMPARE_MODE</td><td>GLenum</td></tr>
1008 <tr><td>TEXTURE_MAG_FILTER</td><td>GLenum</td></tr>
1009 <tr><td>TEXTURE_MAX_LEVEL</td><td>GLint</td></tr>
1010 <tr><td>TEXTURE_MAX_LOD</td><td>GLfloat</td></tr>
1011 <tr><td>TEXTURE_MIN_FILTER</td><td>GLenum</td></tr>
1012 <tr><td>TEXTURE_MIN_LOD</td><td>GLfloat</td></tr>
1013 <tr><td>TEXTURE_SWIZZLE_A</td><td>GLenum</td></tr>
1014 <tr><td>TEXTURE_SWIZZLE_B</td><td>GLenum</td></tr>
1015 <tr><td>TEXTURE_SWIZZLE_G</td><td>GLenum</td></tr>
1016 <tr><td>TEXTURE_SWIZZLE_R</td><td>GLenum</td></tr>
1017 <tr><td>TEXTURE_WRAP_R</td><td>GLenum</td></tr>
1018 <tr><td>TEXTURE_WRAP_S</td><td>GLenum</td></tr>
1019 <tr><td>TEXTURE_WRAP_T</td><td>GLenum</td></tr>
1021 <p>If <em>pname</em> is not in the table above, generates an <code>INVALID_ENUM</code> error.</p>
1022 <p>If an attempt is made to call this function with no WebGLTexture bound (see above), generates an
1023 <code>INVALID_OPERATION</code> error.</p>
1024 <p>If an OpenGL error is generated, returns null.</p>
1028 <!-- ======================================================================================================= -->
1030 <h4>Programs and Shaders</h4>
1032 <dl class="methods">
1033 <dt class="idl-code">any getProgramParameter(WebGLProgram? program, GLenum pname)
1034 <span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf#nameddest=section-6.1.12">OpenGL ES 3.0.2 §6.1.12</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/docs/man3/xhtml/glGetProgramiv.xml">man page</a>)</span>
1037 Return the value for the passed pname given the passed program. The type returned is the natural
1038 type for the requested pname, as given in the following table:
1040 <tr><th>pname</th><th>returned type</th></tr>
1041 <tr><td>DELETE_STATUS</td><td>GLboolean</td></tr>
1042 <tr><td>LINK_STATUS</td><td>GLboolean</td></tr>
1043 <tr><td>VALIDATE_STATUS</td><td>GLboolean</td></tr>
1044 <tr><td>ATTACHED_SHADERS</td><td>GLint</td></tr>
1045 <tr><td>ACTIVE_ATTRIBUTES</td><td>GLint</td></tr>
1046 <tr><td>ACTIVE_UNIFORMS</td><td>GLint</td></tr>
1047 <tr><td>TRANSFORM_FEEDBACK_BUFFER_MODE</td><td>GLenum</td></tr>
1048 <tr><td>TRANSFORM_FEEDBACK_VARYINGS</td><td>GLint</td></tr>
1049 <tr><td>ACTIVE_UNIFORM_BLOCKS</td><td>GLint</td></tr>
1051 <p>If <em>pname</em> is not in the table above, generates an <code>INVALID_ENUM</code> error and returns null.</p>
1052 <p>Returns null if any OpenGL errors are generated during the execution of this
1057 <!-- ======================================================================================================= -->
1059 <h4>Uniforms and attributes</h4>
1061 <!-- ======================================================================================================= -->
1063 <h4>Writing to the drawing buffer</h4>
1065 <!-- ======================================================================================================= -->
1067 <h4>Multiple render targets</h4>
1069 <!-- ======================================================================================================= -->
1071 <h4>Query objects</h4>
1073 <!-- ======================================================================================================= -->
1075 <h4>Sampler objects</h4>
1077 <!-- ======================================================================================================= -->
1079 <h4>Sync objects</h4>
1081 <!-- ======================================================================================================= -->
1083 <h4>Sync objects</h4>
1085 <!-- ======================================================================================================= -->
1087 <h4>Transform feedback</h4>
1089 <!-- ======================================================================================================= -->
1091 <h4>Uniform Buffer objects</h4>
1093 <!-- ======================================================================================================= -->
1095 <h4>Vertex Array objects</h4>
1097 <!-- ======================================================================================================= -->
1099 <h2><a name="webgl_1_2_differences">Other differences Between WebGL 2.0 and WebGL 1.0</a></h2>
1101 <div class="note editor">
1102 Needs update for WebGL 2.0
1106 <li>Compressed textures are supported.</li>
1109 <!-- ======================================================================================================= -->
1111 <h2><a name="webgl_gl_differences">Differences Between WebGL and OpenGL ES 3.0</a></h2>
1113 <div class="note editor">
1114 Needs update for WebGL 2.0
1118 This section describes changes made to the WebGL API relative to the
1119 OpenGL ES 3.0 API to improve portability across various operating
1120 systems and devices.
1123 <!-- ======================================================================================================= -->
1127 <h3>Normative references</h3>
1129 <dt id="refsWEBGL10">[WEBGL10]</dt>
1130 <dd><cite><a href="http://www.khronos.org/registry/webgl/specs/1.0/">
1131 WebGL Specification 1.0.2</a></cite>,
1134 <dt id="refsGLES30">[GLES30]</dt>
1135 <dd><cite><a href="http://www.khronos.org/registry/gles/specs/3.0/es_spec_3.0.2.pdf">
1136 OpenGL® ES Version 3.0.2</a></cite>,
1139 <dt id="refsGLES20GLSL">[GLES30GLSL]</dt>
1140 <dd><cite><a href="http://www.khronos.org/registry/gles/specs/3.0/GLSL_ES_Specification_3.00.4.pdf">
1141 The OpenGL® ES Shading Language Version 3.00</a></cite>,
1142 R. Simpson, March 2013.
1144 <dt id="refsREGISTRY">[REGISTRY]</dt>
1145 <dd><cite><a href="http://www.khronos.org/registry/webgl/extensions/">
1146 WebGL Extension Registry</a></cite>
1148 <dt id="refsRFC2119">[RFC2119]</dt>
1149 <dd><cite><a href="http://www.ietf.org/rfc/rfc2119.txt">
1150 Key words for use in RFCs to Indicate Requirement Levels</a></cite>,
1151 S. Bradner. IETF, March 1997.
1153 <dt id="refsWEBIDL">[WEBIDL]</dt>
1154 <dd><cite><a href="http://dev.w3.org/2006/webapi/WebIDL/">
1155 Web IDL: W3C Editor’s Draft</a></cite>,