1 /* -*- Mode: IDL; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 * You can obtain one at http://mozilla.org/MPL/2.0/.
6 * The origin of this IDL file is
7 * https://www.khronos.org/registry/webgl/specs/latest/webgl.idl
9 * Copyright © 2012 Khronos Group
12 // WebGL IDL definitions scraped from the Khronos specification:
13 // https://www.khronos.org/registry/webgl/specs/latest/
15 // This IDL depends on the typed array specification defined at:
16 // https://www.khronos.org/registry/typedarray/specs/latest/typedarrays.idl
18 typedef unsigned long GLenum;
19 typedef boolean GLboolean;
20 typedef unsigned long GLbitfield;
21 typedef byte GLbyte; /* 'byte' should be a signed 8 bit type. */
22 typedef short GLshort;
25 typedef long long GLintptr;
26 typedef long long GLsizeiptr;
27 // Ideally the typedef below would use 'unsigned byte', but that doesn't currently exist in Web IDL.
28 typedef octet GLubyte; /* 'octet' should be an unsigned 8 bit type. */
29 typedef unsigned short GLushort;
30 typedef unsigned long GLuint;
31 typedef unrestricted float GLfloat;
32 typedef unrestricted float GLclampf;
34 dictionary WebGLContextAttributes {
35 // boolean alpha = true;
36 // We deviate from the spec here.
37 // If alpha isn't specified, we rely on a pref ("webgl.default-no-alpha")
40 boolean stencil = false;
41 boolean antialias = true;
42 boolean premultipliedAlpha = true;
43 boolean preserveDrawingBuffer = false;
46 interface WebGLBuffer {
49 interface WebGLFramebuffer {
52 interface WebGLProgram {
55 interface WebGLRenderbuffer {
58 interface WebGLShader {
61 interface WebGLTexture {
64 interface WebGLUniformLocation {
67 interface WebGLVertexArray {
70 interface WebGLActiveInfo {
71 readonly attribute GLint size;
72 readonly attribute GLenum type;
73 readonly attribute DOMString name;
76 interface WebGLShaderPrecisionFormat {
77 readonly attribute GLint rangeMin;
78 readonly attribute GLint rangeMax;
79 readonly attribute GLint precision;
82 interface WebGLRenderingContext {
85 const GLenum DEPTH_BUFFER_BIT = 0x00000100;
86 const GLenum STENCIL_BUFFER_BIT = 0x00000400;
87 const GLenum COLOR_BUFFER_BIT = 0x00004000;
90 const GLenum POINTS = 0x0000;
91 const GLenum LINES = 0x0001;
92 const GLenum LINE_LOOP = 0x0002;
93 const GLenum LINE_STRIP = 0x0003;
94 const GLenum TRIANGLES = 0x0004;
95 const GLenum TRIANGLE_STRIP = 0x0005;
96 const GLenum TRIANGLE_FAN = 0x0006;
98 /* AlphaFunction (not supported in ES20) */
108 /* BlendingFactorDest */
109 const GLenum ZERO = 0;
110 const GLenum ONE = 1;
111 const GLenum SRC_COLOR = 0x0300;
112 const GLenum ONE_MINUS_SRC_COLOR = 0x0301;
113 const GLenum SRC_ALPHA = 0x0302;
114 const GLenum ONE_MINUS_SRC_ALPHA = 0x0303;
115 const GLenum DST_ALPHA = 0x0304;
116 const GLenum ONE_MINUS_DST_ALPHA = 0x0305;
118 /* BlendingFactorSrc */
121 const GLenum DST_COLOR = 0x0306;
122 const GLenum ONE_MINUS_DST_COLOR = 0x0307;
123 const GLenum SRC_ALPHA_SATURATE = 0x0308;
125 /* ONE_MINUS_SRC_ALPHA */
127 /* ONE_MINUS_DST_ALPHA */
129 /* BlendEquationSeparate */
130 const GLenum FUNC_ADD = 0x8006;
131 const GLenum BLEND_EQUATION = 0x8009;
132 const GLenum BLEND_EQUATION_RGB = 0x8009; /* same as BLEND_EQUATION */
133 const GLenum BLEND_EQUATION_ALPHA = 0x883D;
136 const GLenum FUNC_SUBTRACT = 0x800A;
137 const GLenum FUNC_REVERSE_SUBTRACT = 0x800B;
139 /* Separate Blend Functions */
140 const GLenum BLEND_DST_RGB = 0x80C8;
141 const GLenum BLEND_SRC_RGB = 0x80C9;
142 const GLenum BLEND_DST_ALPHA = 0x80CA;
143 const GLenum BLEND_SRC_ALPHA = 0x80CB;
144 const GLenum CONSTANT_COLOR = 0x8001;
145 const GLenum ONE_MINUS_CONSTANT_COLOR = 0x8002;
146 const GLenum CONSTANT_ALPHA = 0x8003;
147 const GLenum ONE_MINUS_CONSTANT_ALPHA = 0x8004;
148 const GLenum BLEND_COLOR = 0x8005;
151 const GLenum ARRAY_BUFFER = 0x8892;
152 const GLenum ELEMENT_ARRAY_BUFFER = 0x8893;
153 const GLenum ARRAY_BUFFER_BINDING = 0x8894;
154 const GLenum ELEMENT_ARRAY_BUFFER_BINDING = 0x8895;
156 const GLenum STREAM_DRAW = 0x88E0;
157 const GLenum STATIC_DRAW = 0x88E4;
158 const GLenum DYNAMIC_DRAW = 0x88E8;
160 const GLenum BUFFER_SIZE = 0x8764;
161 const GLenum BUFFER_USAGE = 0x8765;
163 const GLenum CURRENT_VERTEX_ATTRIB = 0x8626;
166 const GLenum FRONT = 0x0404;
167 const GLenum BACK = 0x0405;
168 const GLenum FRONT_AND_BACK = 0x0408;
182 const GLenum CULL_FACE = 0x0B44;
183 const GLenum BLEND = 0x0BE2;
184 const GLenum DITHER = 0x0BD0;
185 const GLenum STENCIL_TEST = 0x0B90;
186 const GLenum DEPTH_TEST = 0x0B71;
187 const GLenum SCISSOR_TEST = 0x0C11;
188 const GLenum POLYGON_OFFSET_FILL = 0x8037;
189 const GLenum SAMPLE_ALPHA_TO_COVERAGE = 0x809E;
190 const GLenum SAMPLE_COVERAGE = 0x80A0;
193 const GLenum NO_ERROR = 0;
194 const GLenum INVALID_ENUM = 0x0500;
195 const GLenum INVALID_VALUE = 0x0501;
196 const GLenum INVALID_OPERATION = 0x0502;
197 const GLenum OUT_OF_MEMORY = 0x0505;
199 /* FrontFaceDirection */
200 const GLenum CW = 0x0900;
201 const GLenum CCW = 0x0901;
204 const GLenum LINE_WIDTH = 0x0B21;
205 const GLenum ALIASED_POINT_SIZE_RANGE = 0x846D;
206 const GLenum ALIASED_LINE_WIDTH_RANGE = 0x846E;
207 const GLenum CULL_FACE_MODE = 0x0B45;
208 const GLenum FRONT_FACE = 0x0B46;
209 const GLenum DEPTH_RANGE = 0x0B70;
210 const GLenum DEPTH_WRITEMASK = 0x0B72;
211 const GLenum DEPTH_CLEAR_VALUE = 0x0B73;
212 const GLenum DEPTH_FUNC = 0x0B74;
213 const GLenum STENCIL_CLEAR_VALUE = 0x0B91;
214 const GLenum STENCIL_FUNC = 0x0B92;
215 const GLenum STENCIL_FAIL = 0x0B94;
216 const GLenum STENCIL_PASS_DEPTH_FAIL = 0x0B95;
217 const GLenum STENCIL_PASS_DEPTH_PASS = 0x0B96;
218 const GLenum STENCIL_REF = 0x0B97;
219 const GLenum STENCIL_VALUE_MASK = 0x0B93;
220 const GLenum STENCIL_WRITEMASK = 0x0B98;
221 const GLenum STENCIL_BACK_FUNC = 0x8800;
222 const GLenum STENCIL_BACK_FAIL = 0x8801;
223 const GLenum STENCIL_BACK_PASS_DEPTH_FAIL = 0x8802;
224 const GLenum STENCIL_BACK_PASS_DEPTH_PASS = 0x8803;
225 const GLenum STENCIL_BACK_REF = 0x8CA3;
226 const GLenum STENCIL_BACK_VALUE_MASK = 0x8CA4;
227 const GLenum STENCIL_BACK_WRITEMASK = 0x8CA5;
228 const GLenum VIEWPORT = 0x0BA2;
229 const GLenum SCISSOR_BOX = 0x0C10;
231 const GLenum COLOR_CLEAR_VALUE = 0x0C22;
232 const GLenum COLOR_WRITEMASK = 0x0C23;
233 const GLenum UNPACK_ALIGNMENT = 0x0CF5;
234 const GLenum PACK_ALIGNMENT = 0x0D05;
235 const GLenum MAX_TEXTURE_SIZE = 0x0D33;
236 const GLenum MAX_VIEWPORT_DIMS = 0x0D3A;
237 const GLenum SUBPIXEL_BITS = 0x0D50;
238 const GLenum RED_BITS = 0x0D52;
239 const GLenum GREEN_BITS = 0x0D53;
240 const GLenum BLUE_BITS = 0x0D54;
241 const GLenum ALPHA_BITS = 0x0D55;
242 const GLenum DEPTH_BITS = 0x0D56;
243 const GLenum STENCIL_BITS = 0x0D57;
244 const GLenum POLYGON_OFFSET_UNITS = 0x2A00;
245 /* POLYGON_OFFSET_FILL */
246 const GLenum POLYGON_OFFSET_FACTOR = 0x8038;
247 const GLenum TEXTURE_BINDING_2D = 0x8069;
248 const GLenum SAMPLE_BUFFERS = 0x80A8;
249 const GLenum SAMPLES = 0x80A9;
250 const GLenum SAMPLE_COVERAGE_VALUE = 0x80AA;
251 const GLenum SAMPLE_COVERAGE_INVERT = 0x80AB;
253 /* GetTextureParameter */
254 /* TEXTURE_MAG_FILTER */
255 /* TEXTURE_MIN_FILTER */
259 const GLenum COMPRESSED_TEXTURE_FORMATS = 0x86A3;
262 const GLenum DONT_CARE = 0x1100;
263 const GLenum FASTEST = 0x1101;
264 const GLenum NICEST = 0x1102;
267 const GLenum GENERATE_MIPMAP_HINT = 0x8192;
270 const GLenum BYTE = 0x1400;
271 const GLenum UNSIGNED_BYTE = 0x1401;
272 const GLenum SHORT = 0x1402;
273 const GLenum UNSIGNED_SHORT = 0x1403;
274 const GLenum INT = 0x1404;
275 const GLenum UNSIGNED_INT = 0x1405;
276 const GLenum FLOAT = 0x1406;
279 const GLenum DEPTH_COMPONENT = 0x1902;
280 const GLenum ALPHA = 0x1906;
281 const GLenum RGB = 0x1907;
282 const GLenum RGBA = 0x1908;
283 const GLenum LUMINANCE = 0x1909;
284 const GLenum LUMINANCE_ALPHA = 0x190A;
288 const GLenum UNSIGNED_SHORT_4_4_4_4 = 0x8033;
289 const GLenum UNSIGNED_SHORT_5_5_5_1 = 0x8034;
290 const GLenum UNSIGNED_SHORT_5_6_5 = 0x8363;
293 const GLenum FRAGMENT_SHADER = 0x8B30;
294 const GLenum VERTEX_SHADER = 0x8B31;
295 const GLenum MAX_VERTEX_ATTRIBS = 0x8869;
296 const GLenum MAX_VERTEX_UNIFORM_VECTORS = 0x8DFB;
297 const GLenum MAX_VARYING_VECTORS = 0x8DFC;
298 const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
299 const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS = 0x8B4C;
300 const GLenum MAX_TEXTURE_IMAGE_UNITS = 0x8872;
301 const GLenum MAX_FRAGMENT_UNIFORM_VECTORS = 0x8DFD;
302 const GLenum SHADER_TYPE = 0x8B4F;
303 const GLenum DELETE_STATUS = 0x8B80;
304 const GLenum LINK_STATUS = 0x8B82;
305 const GLenum VALIDATE_STATUS = 0x8B83;
306 const GLenum ATTACHED_SHADERS = 0x8B85;
307 const GLenum ACTIVE_UNIFORMS = 0x8B86;
308 const GLenum ACTIVE_ATTRIBUTES = 0x8B89;
309 const GLenum SHADING_LANGUAGE_VERSION = 0x8B8C;
310 const GLenum CURRENT_PROGRAM = 0x8B8D;
312 /* StencilFunction */
313 const GLenum NEVER = 0x0200;
314 const GLenum LESS = 0x0201;
315 const GLenum EQUAL = 0x0202;
316 const GLenum LEQUAL = 0x0203;
317 const GLenum GREATER = 0x0204;
318 const GLenum NOTEQUAL = 0x0205;
319 const GLenum GEQUAL = 0x0206;
320 const GLenum ALWAYS = 0x0207;
324 const GLenum KEEP = 0x1E00;
325 const GLenum REPLACE = 0x1E01;
326 const GLenum INCR = 0x1E02;
327 const GLenum DECR = 0x1E03;
328 const GLenum INVERT = 0x150A;
329 const GLenum INCR_WRAP = 0x8507;
330 const GLenum DECR_WRAP = 0x8508;
333 const GLenum VENDOR = 0x1F00;
334 const GLenum RENDERER = 0x1F01;
335 const GLenum VERSION = 0x1F02;
337 /* TextureMagFilter */
338 const GLenum NEAREST = 0x2600;
339 const GLenum LINEAR = 0x2601;
341 /* TextureMinFilter */
344 const GLenum NEAREST_MIPMAP_NEAREST = 0x2700;
345 const GLenum LINEAR_MIPMAP_NEAREST = 0x2701;
346 const GLenum NEAREST_MIPMAP_LINEAR = 0x2702;
347 const GLenum LINEAR_MIPMAP_LINEAR = 0x2703;
349 /* TextureParameterName */
350 const GLenum TEXTURE_MAG_FILTER = 0x2800;
351 const GLenum TEXTURE_MIN_FILTER = 0x2801;
352 const GLenum TEXTURE_WRAP_S = 0x2802;
353 const GLenum TEXTURE_WRAP_T = 0x2803;
356 const GLenum TEXTURE_2D = 0x0DE1;
357 const GLenum TEXTURE = 0x1702;
359 const GLenum TEXTURE_CUBE_MAP = 0x8513;
360 const GLenum TEXTURE_BINDING_CUBE_MAP = 0x8514;
361 const GLenum TEXTURE_CUBE_MAP_POSITIVE_X = 0x8515;
362 const GLenum TEXTURE_CUBE_MAP_NEGATIVE_X = 0x8516;
363 const GLenum TEXTURE_CUBE_MAP_POSITIVE_Y = 0x8517;
364 const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Y = 0x8518;
365 const GLenum TEXTURE_CUBE_MAP_POSITIVE_Z = 0x8519;
366 const GLenum TEXTURE_CUBE_MAP_NEGATIVE_Z = 0x851A;
367 const GLenum MAX_CUBE_MAP_TEXTURE_SIZE = 0x851C;
370 const GLenum TEXTURE0 = 0x84C0;
371 const GLenum TEXTURE1 = 0x84C1;
372 const GLenum TEXTURE2 = 0x84C2;
373 const GLenum TEXTURE3 = 0x84C3;
374 const GLenum TEXTURE4 = 0x84C4;
375 const GLenum TEXTURE5 = 0x84C5;
376 const GLenum TEXTURE6 = 0x84C6;
377 const GLenum TEXTURE7 = 0x84C7;
378 const GLenum TEXTURE8 = 0x84C8;
379 const GLenum TEXTURE9 = 0x84C9;
380 const GLenum TEXTURE10 = 0x84CA;
381 const GLenum TEXTURE11 = 0x84CB;
382 const GLenum TEXTURE12 = 0x84CC;
383 const GLenum TEXTURE13 = 0x84CD;
384 const GLenum TEXTURE14 = 0x84CE;
385 const GLenum TEXTURE15 = 0x84CF;
386 const GLenum TEXTURE16 = 0x84D0;
387 const GLenum TEXTURE17 = 0x84D1;
388 const GLenum TEXTURE18 = 0x84D2;
389 const GLenum TEXTURE19 = 0x84D3;
390 const GLenum TEXTURE20 = 0x84D4;
391 const GLenum TEXTURE21 = 0x84D5;
392 const GLenum TEXTURE22 = 0x84D6;
393 const GLenum TEXTURE23 = 0x84D7;
394 const GLenum TEXTURE24 = 0x84D8;
395 const GLenum TEXTURE25 = 0x84D9;
396 const GLenum TEXTURE26 = 0x84DA;
397 const GLenum TEXTURE27 = 0x84DB;
398 const GLenum TEXTURE28 = 0x84DC;
399 const GLenum TEXTURE29 = 0x84DD;
400 const GLenum TEXTURE30 = 0x84DE;
401 const GLenum TEXTURE31 = 0x84DF;
402 const GLenum ACTIVE_TEXTURE = 0x84E0;
404 /* TextureWrapMode */
405 const GLenum REPEAT = 0x2901;
406 const GLenum CLAMP_TO_EDGE = 0x812F;
407 const GLenum MIRRORED_REPEAT = 0x8370;
410 const GLenum FLOAT_VEC2 = 0x8B50;
411 const GLenum FLOAT_VEC3 = 0x8B51;
412 const GLenum FLOAT_VEC4 = 0x8B52;
413 const GLenum INT_VEC2 = 0x8B53;
414 const GLenum INT_VEC3 = 0x8B54;
415 const GLenum INT_VEC4 = 0x8B55;
416 const GLenum BOOL = 0x8B56;
417 const GLenum BOOL_VEC2 = 0x8B57;
418 const GLenum BOOL_VEC3 = 0x8B58;
419 const GLenum BOOL_VEC4 = 0x8B59;
420 const GLenum FLOAT_MAT2 = 0x8B5A;
421 const GLenum FLOAT_MAT3 = 0x8B5B;
422 const GLenum FLOAT_MAT4 = 0x8B5C;
423 const GLenum SAMPLER_2D = 0x8B5E;
424 const GLenum SAMPLER_CUBE = 0x8B60;
427 const GLenum VERTEX_ATTRIB_ARRAY_ENABLED = 0x8622;
428 const GLenum VERTEX_ATTRIB_ARRAY_SIZE = 0x8623;
429 const GLenum VERTEX_ATTRIB_ARRAY_STRIDE = 0x8624;
430 const GLenum VERTEX_ATTRIB_ARRAY_TYPE = 0x8625;
431 const GLenum VERTEX_ATTRIB_ARRAY_NORMALIZED = 0x886A;
432 const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645;
433 const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
436 const GLenum COMPILE_STATUS = 0x8B81;
438 /* Shader Precision-Specified Types */
439 const GLenum LOW_FLOAT = 0x8DF0;
440 const GLenum MEDIUM_FLOAT = 0x8DF1;
441 const GLenum HIGH_FLOAT = 0x8DF2;
442 const GLenum LOW_INT = 0x8DF3;
443 const GLenum MEDIUM_INT = 0x8DF4;
444 const GLenum HIGH_INT = 0x8DF5;
446 /* Framebuffer Object. */
447 const GLenum FRAMEBUFFER = 0x8D40;
448 const GLenum RENDERBUFFER = 0x8D41;
450 const GLenum RGBA4 = 0x8056;
451 const GLenum RGB5_A1 = 0x8057;
452 const GLenum RGB565 = 0x8D62;
453 const GLenum DEPTH_COMPONENT16 = 0x81A5;
454 const GLenum STENCIL_INDEX = 0x1901;
455 const GLenum STENCIL_INDEX8 = 0x8D48;
456 const GLenum DEPTH_STENCIL = 0x84F9;
458 const GLenum RENDERBUFFER_WIDTH = 0x8D42;
459 const GLenum RENDERBUFFER_HEIGHT = 0x8D43;
460 const GLenum RENDERBUFFER_INTERNAL_FORMAT = 0x8D44;
461 const GLenum RENDERBUFFER_RED_SIZE = 0x8D50;
462 const GLenum RENDERBUFFER_GREEN_SIZE = 0x8D51;
463 const GLenum RENDERBUFFER_BLUE_SIZE = 0x8D52;
464 const GLenum RENDERBUFFER_ALPHA_SIZE = 0x8D53;
465 const GLenum RENDERBUFFER_DEPTH_SIZE = 0x8D54;
466 const GLenum RENDERBUFFER_STENCIL_SIZE = 0x8D55;
468 const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE = 0x8CD0;
469 const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME = 0x8CD1;
470 const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL = 0x8CD2;
471 const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
473 const GLenum COLOR_ATTACHMENT0 = 0x8CE0;
474 const GLenum DEPTH_ATTACHMENT = 0x8D00;
475 const GLenum STENCIL_ATTACHMENT = 0x8D20;
476 const GLenum DEPTH_STENCIL_ATTACHMENT = 0x821A;
478 const GLenum NONE = 0;
480 const GLenum FRAMEBUFFER_COMPLETE = 0x8CD5;
481 const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT = 0x8CD6;
482 const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
483 const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS = 0x8CD9;
484 const GLenum FRAMEBUFFER_UNSUPPORTED = 0x8CDD;
486 const GLenum FRAMEBUFFER_BINDING = 0x8CA6;
487 const GLenum RENDERBUFFER_BINDING = 0x8CA7;
488 const GLenum MAX_RENDERBUFFER_SIZE = 0x84E8;
490 const GLenum INVALID_FRAMEBUFFER_OPERATION = 0x0506;
492 /* WebGL-specific enums */
493 const GLenum UNPACK_FLIP_Y_WEBGL = 0x9240;
494 const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
495 const GLenum CONTEXT_LOST_WEBGL = 0x9242;
496 const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
497 const GLenum BROWSER_DEFAULT_WEBGL = 0x9244;
499 // The canvas might actually be null in some cases, apparently.
500 readonly attribute HTMLCanvasElement? canvas;
501 readonly attribute GLsizei drawingBufferWidth;
502 readonly attribute GLsizei drawingBufferHeight;
504 [WebGLHandlesContextLoss] WebGLContextAttributes? getContextAttributes();
505 [WebGLHandlesContextLoss] boolean isContextLost();
507 sequence<DOMString>? getSupportedExtensions();
510 object? getExtension(DOMString name);
512 void activeTexture(GLenum texture);
513 void attachShader(WebGLProgram? program, WebGLShader? shader);
514 void bindAttribLocation(WebGLProgram? program, GLuint index, DOMString name);
515 void bindBuffer(GLenum target, WebGLBuffer? buffer);
516 void bindFramebuffer(GLenum target, WebGLFramebuffer? framebuffer);
517 void bindRenderbuffer(GLenum target, WebGLRenderbuffer? renderbuffer);
518 void bindTexture(GLenum target, WebGLTexture? texture);
519 void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
520 void blendEquation(GLenum mode);
521 void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
522 void blendFunc(GLenum sfactor, GLenum dfactor);
523 void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
524 GLenum srcAlpha, GLenum dstAlpha);
526 void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
527 void bufferData(GLenum target, ArrayBufferView data, GLenum usage);
528 void bufferData(GLenum target, ArrayBuffer? data, GLenum usage);
529 void bufferSubData(GLenum target, GLintptr offset, ArrayBufferView data);
530 void bufferSubData(GLenum target, GLintptr offset, ArrayBuffer? data);
532 [WebGLHandlesContextLoss] GLenum checkFramebufferStatus(GLenum target);
533 void clear(GLbitfield mask);
534 void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
535 void clearDepth(GLclampf depth);
536 void clearStencil(GLint s);
537 void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
538 void compileShader(WebGLShader? shader);
540 void compressedTexImage2D(GLenum target, GLint level, GLenum internalformat,
541 GLsizei width, GLsizei height, GLint border,
542 ArrayBufferView data);
543 void compressedTexSubImage2D(GLenum target, GLint level,
544 GLint xoffset, GLint yoffset,
545 GLsizei width, GLsizei height, GLenum format,
546 ArrayBufferView data);
548 void copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
549 GLint x, GLint y, GLsizei width, GLsizei height,
551 void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
552 GLint x, GLint y, GLsizei width, GLsizei height);
554 WebGLBuffer? createBuffer();
555 WebGLFramebuffer? createFramebuffer();
556 WebGLProgram? createProgram();
557 WebGLRenderbuffer? createRenderbuffer();
558 WebGLShader? createShader(GLenum type);
559 WebGLTexture? createTexture();
561 void cullFace(GLenum mode);
563 void deleteBuffer(WebGLBuffer? buffer);
564 void deleteFramebuffer(WebGLFramebuffer? framebuffer);
565 void deleteProgram(WebGLProgram? program);
566 void deleteRenderbuffer(WebGLRenderbuffer? renderbuffer);
567 void deleteShader(WebGLShader? shader);
568 void deleteTexture(WebGLTexture? texture);
570 void depthFunc(GLenum func);
571 void depthMask(GLboolean flag);
572 void depthRange(GLclampf zNear, GLclampf zFar);
573 void detachShader(WebGLProgram? program, WebGLShader? shader);
574 void disable(GLenum cap);
575 void disableVertexAttribArray(GLuint index);
576 void drawArrays(GLenum mode, GLint first, GLsizei count);
577 void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset);
579 void enable(GLenum cap);
580 void enableVertexAttribArray(GLuint index);
583 void framebufferRenderbuffer(GLenum target, GLenum attachment,
584 GLenum renderbuffertarget,
585 WebGLRenderbuffer? renderbuffer);
586 void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget,
587 WebGLTexture? texture, GLint level);
588 void frontFace(GLenum mode);
590 void generateMipmap(GLenum target);
593 WebGLActiveInfo? getActiveAttrib(WebGLProgram? program, GLuint index);
595 WebGLActiveInfo? getActiveUniform(WebGLProgram? program, GLuint index);
597 sequence<WebGLShader>? getAttachedShaders(WebGLProgram? program);
599 [WebGLHandlesContextLoss] GLint getAttribLocation(WebGLProgram? program, DOMString name);
601 any getBufferParameter(GLenum target, GLenum pname);
603 any getParameter(GLenum pname);
605 [WebGLHandlesContextLoss] GLenum getError();
608 any getFramebufferAttachmentParameter(GLenum target, GLenum attachment,
610 any getProgramParameter(WebGLProgram? program, GLenum pname);
611 DOMString? getProgramInfoLog(WebGLProgram? program);
612 any getRenderbufferParameter(GLenum target, GLenum pname);
613 any getShaderParameter(WebGLShader? shader, GLenum pname);
616 WebGLShaderPrecisionFormat? getShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype);
618 DOMString? getShaderInfoLog(WebGLShader? shader);
620 DOMString? getShaderSource(WebGLShader? shader);
622 any getTexParameter(GLenum target, GLenum pname);
624 any getUniform(WebGLProgram? program, WebGLUniformLocation? location);
627 WebGLUniformLocation? getUniformLocation(WebGLProgram? program, DOMString name);
630 any getVertexAttrib(GLuint index, GLenum pname);
632 [WebGLHandlesContextLoss] GLsizeiptr getVertexAttribOffset(GLuint index, GLenum pname);
634 void hint(GLenum target, GLenum mode);
635 [WebGLHandlesContextLoss] GLboolean isBuffer(WebGLBuffer? buffer);
636 [WebGLHandlesContextLoss] GLboolean isEnabled(GLenum cap);
637 [WebGLHandlesContextLoss] GLboolean isFramebuffer(WebGLFramebuffer? framebuffer);
638 [WebGLHandlesContextLoss] GLboolean isProgram(WebGLProgram? program);
639 [WebGLHandlesContextLoss] GLboolean isRenderbuffer(WebGLRenderbuffer? renderbuffer);
640 [WebGLHandlesContextLoss] GLboolean isShader(WebGLShader? shader);
641 [WebGLHandlesContextLoss] GLboolean isTexture(WebGLTexture? texture);
642 void lineWidth(GLfloat width);
643 void linkProgram(WebGLProgram? program);
644 void pixelStorei(GLenum pname, GLint param);
645 void polygonOffset(GLfloat factor, GLfloat units);
648 void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
649 GLenum format, GLenum type, ArrayBufferView? pixels);
651 void renderbufferStorage(GLenum target, GLenum internalformat,
652 GLsizei width, GLsizei height);
653 void sampleCoverage(GLclampf value, GLboolean invert);
654 void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
656 void shaderSource(WebGLShader? shader, DOMString source);
658 void stencilFunc(GLenum func, GLint ref, GLuint mask);
659 void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
660 void stencilMask(GLuint mask);
661 void stencilMaskSeparate(GLenum face, GLuint mask);
662 void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
663 void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
667 void texImage2D(GLenum target, GLint level, GLenum internalformat,
668 GLsizei width, GLsizei height, GLint border, GLenum format,
669 GLenum type, ArrayBufferView? pixels);
671 void texImage2D(GLenum target, GLint level, GLenum internalformat,
672 GLenum format, GLenum type, ImageData? pixels);
674 void texImage2D(GLenum target, GLint level, GLenum internalformat,
675 GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException
677 void texImage2D(GLenum target, GLint level, GLenum internalformat,
678 GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException
680 void texImage2D(GLenum target, GLint level, GLenum internalformat,
681 GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException
683 void texParameterf(GLenum target, GLenum pname, GLfloat param);
684 void texParameteri(GLenum target, GLenum pname, GLint param);
687 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
688 GLsizei width, GLsizei height,
689 GLenum format, GLenum type, ArrayBufferView? pixels);
691 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
692 GLenum format, GLenum type, ImageData? pixels);
694 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
695 GLenum format, GLenum type, HTMLImageElement image); // May throw DOMException
697 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
698 GLenum format, GLenum type, HTMLCanvasElement canvas); // May throw DOMException
700 void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
701 GLenum format, GLenum type, HTMLVideoElement video); // May throw DOMException
703 void uniform1f(WebGLUniformLocation? location, GLfloat x);
704 void uniform1fv(WebGLUniformLocation? location, Float32Array v);
705 void uniform1fv(WebGLUniformLocation? location, sequence<GLfloat> v);
706 void uniform1i(WebGLUniformLocation? location, GLint x);
707 void uniform1iv(WebGLUniformLocation? location, Int32Array v);
708 void uniform1iv(WebGLUniformLocation? location, sequence<long> v);
709 void uniform2f(WebGLUniformLocation? location, GLfloat x, GLfloat y);
710 void uniform2fv(WebGLUniformLocation? location, Float32Array v);
711 void uniform2fv(WebGLUniformLocation? location, sequence<GLfloat> v);
712 void uniform2i(WebGLUniformLocation? location, GLint x, GLint y);
713 void uniform2iv(WebGLUniformLocation? location, Int32Array v);
714 void uniform2iv(WebGLUniformLocation? location, sequence<long> v);
715 void uniform3f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z);
716 void uniform3fv(WebGLUniformLocation? location, Float32Array v);
717 void uniform3fv(WebGLUniformLocation? location, sequence<GLfloat> v);
718 void uniform3i(WebGLUniformLocation? location, GLint x, GLint y, GLint z);
719 void uniform3iv(WebGLUniformLocation? location, Int32Array v);
720 void uniform3iv(WebGLUniformLocation? location, sequence<long> v);
721 void uniform4f(WebGLUniformLocation? location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
722 void uniform4fv(WebGLUniformLocation? location, Float32Array v);
723 void uniform4fv(WebGLUniformLocation? location, sequence<GLfloat> v);
724 void uniform4i(WebGLUniformLocation? location, GLint x, GLint y, GLint z, GLint w);
725 void uniform4iv(WebGLUniformLocation? location, Int32Array v);
726 void uniform4iv(WebGLUniformLocation? location, sequence<long> v);
728 void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
730 void uniformMatrix2fv(WebGLUniformLocation? location, GLboolean transpose,
731 sequence<GLfloat> value);
732 void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
734 void uniformMatrix3fv(WebGLUniformLocation? location, GLboolean transpose,
735 sequence<GLfloat> value);
736 void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
738 void uniformMatrix4fv(WebGLUniformLocation? location, GLboolean transpose,
739 sequence<GLfloat> value);
741 void useProgram(WebGLProgram? program);
742 void validateProgram(WebGLProgram? program);
744 void vertexAttrib1f(GLuint indx, GLfloat x);
745 void vertexAttrib1fv(GLuint indx, Float32Array values);
746 void vertexAttrib1fv(GLuint indx, sequence<GLfloat> values);
747 void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
748 void vertexAttrib2fv(GLuint indx, Float32Array values);
749 void vertexAttrib2fv(GLuint indx, sequence<GLfloat> values);
750 void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
751 void vertexAttrib3fv(GLuint indx, Float32Array values);
752 void vertexAttrib3fv(GLuint indx, sequence<GLfloat> values);
753 void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
754 void vertexAttrib4fv(GLuint indx, Float32Array values);
755 void vertexAttrib4fv(GLuint indx, sequence<GLfloat> values);
756 void vertexAttribPointer(GLuint indx, GLint size, GLenum type,
757 GLboolean normalized, GLsizei stride, GLintptr offset);
759 void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
762 /*[Constructor(DOMString type, optional WebGLContextEventInit eventInit)]
763 interface WebGLContextEvent : Event {
764 readonly attribute DOMString statusMessage;
767 // EventInit is defined in the DOM4 specification.
768 /*dictionary WebGLContextEventInit : EventInit {
769 DOMString statusMessage;
773 // specific extension interfaces
776 interface WebGLExtensionCompressedTextureS3TC
778 const GLenum COMPRESSED_RGB_S3TC_DXT1_EXT = 0x83F0;
779 const GLenum COMPRESSED_RGBA_S3TC_DXT1_EXT = 0x83F1;
780 const GLenum COMPRESSED_RGBA_S3TC_DXT3_EXT = 0x83F2;
781 const GLenum COMPRESSED_RGBA_S3TC_DXT5_EXT = 0x83F3;
785 interface WebGLExtensionCompressedTextureATC
787 const GLenum COMPRESSED_RGB_ATC_WEBGL = 0x8C92;
788 const GLenum COMPRESSED_RGBA_ATC_EXPLICIT_ALPHA_WEBGL = 0x8C93;
789 const GLenum COMPRESSED_RGBA_ATC_INTERPOLATED_ALPHA_WEBGL = 0x87EE;
793 interface WebGLExtensionCompressedTexturePVRTC
795 const GLenum COMPRESSED_RGB_PVRTC_4BPPV1 = 0x8C00;
796 const GLenum COMPRESSED_RGB_PVRTC_2BPPV1 = 0x8C01;
797 const GLenum COMPRESSED_RGBA_PVRTC_4BPPV1 = 0x8C02;
798 const GLenum COMPRESSED_RGBA_PVRTC_2BPPV1 = 0x8C03;
802 interface WebGLExtensionDebugRendererInfo
804 const GLenum UNMASKED_VENDOR_WEBGL = 0x9245;
805 const GLenum UNMASKED_RENDERER_WEBGL = 0x9246;
809 interface WebGLExtensionDepthTexture
811 const GLenum UNSIGNED_INT_24_8_WEBGL = 0x84FA;
815 interface WebGLExtensionElementIndexUint
820 interface WebGLExtensionLoseContext {
822 void restoreContext();
826 interface WebGLExtensionTextureFilterAnisotropic
828 const GLenum TEXTURE_MAX_ANISOTROPY_EXT = 0x84FE;
829 const GLenum MAX_TEXTURE_MAX_ANISOTROPY_EXT = 0x84FF;
833 interface WebGLExtensionSRGB
835 const GLenum SRGB_EXT = 0x8C40;
836 const GLenum SRGB_ALPHA_EXT = 0x8C42;
837 const GLenum SRGB8_ALPHA8_EXT = 0x8C43;
838 const GLenum FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT = 0x8210;
842 interface WebGLExtensionStandardDerivatives {
843 const GLenum FRAGMENT_SHADER_DERIVATIVE_HINT_OES = 0x8B8B;
847 interface WebGLExtensionTextureFloat
852 interface WebGLExtensionDrawBuffers {
853 const GLenum COLOR_ATTACHMENT0_WEBGL = 0x8CE0;
854 const GLenum COLOR_ATTACHMENT1_WEBGL = 0x8CE1;
855 const GLenum COLOR_ATTACHMENT2_WEBGL = 0x8CE2;
856 const GLenum COLOR_ATTACHMENT3_WEBGL = 0x8CE3;
857 const GLenum COLOR_ATTACHMENT4_WEBGL = 0x8CE4;
858 const GLenum COLOR_ATTACHMENT5_WEBGL = 0x8CE5;
859 const GLenum COLOR_ATTACHMENT6_WEBGL = 0x8CE6;
860 const GLenum COLOR_ATTACHMENT7_WEBGL = 0x8CE7;
861 const GLenum COLOR_ATTACHMENT8_WEBGL = 0x8CE8;
862 const GLenum COLOR_ATTACHMENT9_WEBGL = 0x8CE9;
863 const GLenum COLOR_ATTACHMENT10_WEBGL = 0x8CEA;
864 const GLenum COLOR_ATTACHMENT11_WEBGL = 0x8CEB;
865 const GLenum COLOR_ATTACHMENT12_WEBGL = 0x8CEC;
866 const GLenum COLOR_ATTACHMENT13_WEBGL = 0x8CED;
867 const GLenum COLOR_ATTACHMENT14_WEBGL = 0x8CEE;
868 const GLenum COLOR_ATTACHMENT15_WEBGL = 0x8CEF;
870 const GLenum DRAW_BUFFER0_WEBGL = 0x8825;
871 const GLenum DRAW_BUFFER1_WEBGL = 0x8826;
872 const GLenum DRAW_BUFFER2_WEBGL = 0x8827;
873 const GLenum DRAW_BUFFER3_WEBGL = 0x8828;
874 const GLenum DRAW_BUFFER4_WEBGL = 0x8829;
875 const GLenum DRAW_BUFFER5_WEBGL = 0x882A;
876 const GLenum DRAW_BUFFER6_WEBGL = 0x882B;
877 const GLenum DRAW_BUFFER7_WEBGL = 0x882C;
878 const GLenum DRAW_BUFFER8_WEBGL = 0x882D;
879 const GLenum DRAW_BUFFER9_WEBGL = 0x882E;
880 const GLenum DRAW_BUFFER10_WEBGL = 0x882F;
881 const GLenum DRAW_BUFFER11_WEBGL = 0x8830;
882 const GLenum DRAW_BUFFER12_WEBGL = 0x8831;
883 const GLenum DRAW_BUFFER13_WEBGL = 0x8832;
884 const GLenum DRAW_BUFFER14_WEBGL = 0x8833;
885 const GLenum DRAW_BUFFER15_WEBGL = 0x8834;
887 const GLenum MAX_COLOR_ATTACHMENTS_WEBGL = 0x8CDF;
888 const GLenum MAX_DRAW_BUFFERS_WEBGL = 0x8824;
890 void drawBuffersWEBGL(sequence<GLenum> buffers);
894 interface WebGLExtensionTextureFloatLinear
899 interface WebGLExtensionVertexArray {
900 const GLenum VERTEX_ARRAY_BINDING_OES = 0x85B5;
902 WebGLVertexArray? createVertexArrayOES();
903 void deleteVertexArrayOES(WebGLVertexArray? arrayObject);
904 [WebGLHandlesContextLoss] GLboolean isVertexArrayOES(WebGLVertexArray? arrayObject);
905 void bindVertexArrayOES(WebGLVertexArray? arrayObject);
909 interface WebGLExtensionInstancedArrays {
910 const GLenum VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE = 0x88FE;
912 void drawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount);
913 void drawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, GLintptr offset, GLsizei primcount);
914 void vertexAttribDivisorANGLE(GLuint index, GLuint divisor);