1/*
2 * webgl.idl
3 *
4 * WebGL IDL definitions scraped from the Khronos specification.
5 *
6 * Original Khronos Working Draft:
7 *
8 *   https://www.khronos.org/registry/webgl/specs/latest/
9 */
10
11// This module depends on the typedarrays module defined at:
12// https://www.khronos.org/registry/typedarray/specs/latest/typedarrays.idl
13
14module webgl {
15
16typedef events::Event Event;
17typedef html::HTMLCanvasElement HTMLCanvasElement;
18typedef html::HTMLImageElement HTMLImageElement;
19typedef html::HTMLVideoElement HTMLVideoElement;
20typedef html::ImageData ImageData;
21typedef typedarrays::ArrayBuffer ArrayBuffer;
22typedef typedarrays::ArrayBufferView ArrayBufferView;
23typedef typedarrays::FloatArray FloatArray;
24typedef typedarrays::Int32Array Int32Array;
25
26typedef unsigned long  GLenum;
27typedef boolean        GLboolean;
28typedef unsigned long  GLbitfield;
29typedef byte           GLbyte;         /* 'byte' should be a signed 8 bit type. */
30typedef short          GLshort;
31typedef long           GLint;
32typedef long           GLsizei;
33typedef long long      GLintptr;
34typedef long long      GLsizeiptr;
35typedef unsigned byte  GLubyte;        /* 'unsigned byte' should be an unsigned 8 bit type. */
36typedef unsigned short GLushort;
37typedef unsigned long  GLuint;
38typedef float          GLfloat;
39typedef float          GLclampf;
40
41interface WebGLContextAttributes {
42    attribute boolean alpha;
43    attribute boolean depth;
44    attribute boolean stencil;
45    attribute boolean antialias;
46    attribute boolean premultipliedAlpha;
47};
48
49interface WebGLObject {
50};
51
52interface WebGLBuffer : WebGLObject {
53};
54
55interface WebGLFramebuffer : WebGLObject {
56};
57
58interface WebGLProgram : WebGLObject {
59};
60
61interface WebGLRenderbuffer : WebGLObject {
62};
63
64interface WebGLShader : WebGLObject {
65};
66
67interface WebGLTexture : WebGLObject {
68};
69
70interface WebGLUniformLocation {
71};
72
73interface WebGLActiveInfo {
74    readonly attribute GLint size;
75    readonly attribute GLenum type;
76    readonly attribute DOMString name;
77};
78
79interface WebGLRenderingContext {
80
81    /* ClearBufferMask */
82    const GLenum DEPTH_BUFFER_BIT               = 0x00000100;
83    const GLenum STENCIL_BUFFER_BIT             = 0x00000400;
84    const GLenum COLOR_BUFFER_BIT               = 0x00004000;
85
86    /* BeginMode */
87    const GLenum POINTS                         = 0x0000;
88    const GLenum LINES                          = 0x0001;
89    const GLenum LINE_LOOP                      = 0x0002;
90    const GLenum LINE_STRIP                     = 0x0003;
91    const GLenum TRIANGLES                      = 0x0004;
92    const GLenum TRIANGLE_STRIP                 = 0x0005;
93    const GLenum TRIANGLE_FAN                   = 0x0006;
94
95    /* AlphaFunction (not supported in ES20) */
96    /*      NEVER */
97    /*      LESS */
98    /*      EQUAL */
99    /*      LEQUAL */
100    /*      GREATER */
101    /*      NOTEQUAL */
102    /*      GEQUAL */
103    /*      ALWAYS */
104
105    /* BlendingFactorDest */
106    const GLenum ZERO                           = 0;
107    const GLenum ONE                            = 1;
108    const GLenum SRC_COLOR                      = 0x0300;
109    const GLenum ONE_MINUS_SRC_COLOR            = 0x0301;
110    const GLenum SRC_ALPHA                      = 0x0302;
111    const GLenum ONE_MINUS_SRC_ALPHA            = 0x0303;
112    const GLenum DST_ALPHA                      = 0x0304;
113    const GLenum ONE_MINUS_DST_ALPHA            = 0x0305;
114
115    /* BlendingFactorSrc */
116    /*      ZERO */
117    /*      ONE */
118    const GLenum DST_COLOR                      = 0x0306;
119    const GLenum ONE_MINUS_DST_COLOR            = 0x0307;
120    const GLenum SRC_ALPHA_SATURATE             = 0x0308;
121    /*      SRC_ALPHA */
122    /*      ONE_MINUS_SRC_ALPHA */
123    /*      DST_ALPHA */
124    /*      ONE_MINUS_DST_ALPHA */
125
126    /* BlendEquationSeparate */
127    const GLenum FUNC_ADD                       = 0x8006;
128    const GLenum BLEND_EQUATION                 = 0x8009;
129    const GLenum BLEND_EQUATION_RGB             = 0x8009;   /* same as BLEND_EQUATION */
130    const GLenum BLEND_EQUATION_ALPHA           = 0x883D;
131
132    /* BlendSubtract */
133    const GLenum FUNC_SUBTRACT                  = 0x800A;
134    const GLenum FUNC_REVERSE_SUBTRACT          = 0x800B;
135
136    /* Separate Blend Functions */
137    const GLenum BLEND_DST_RGB                  = 0x80C8;
138    const GLenum BLEND_SRC_RGB                  = 0x80C9;
139    const GLenum BLEND_DST_ALPHA                = 0x80CA;
140    const GLenum BLEND_SRC_ALPHA                = 0x80CB;
141    const GLenum CONSTANT_COLOR                 = 0x8001;
142    const GLenum ONE_MINUS_CONSTANT_COLOR       = 0x8002;
143    const GLenum CONSTANT_ALPHA                 = 0x8003;
144    const GLenum ONE_MINUS_CONSTANT_ALPHA       = 0x8004;
145    const GLenum BLEND_COLOR                    = 0x8005;
146
147    /* Buffer Objects */
148    const GLenum ARRAY_BUFFER                   = 0x8892;
149    const GLenum ELEMENT_ARRAY_BUFFER           = 0x8893;
150    const GLenum ARRAY_BUFFER_BINDING           = 0x8894;
151    const GLenum ELEMENT_ARRAY_BUFFER_BINDING   = 0x8895;
152
153    const GLenum STREAM_DRAW                    = 0x88E0;
154    const GLenum STATIC_DRAW                    = 0x88E4;
155    const GLenum DYNAMIC_DRAW                   = 0x88E8;
156
157    const GLenum BUFFER_SIZE                    = 0x8764;
158    const GLenum BUFFER_USAGE                   = 0x8765;
159
160    const GLenum CURRENT_VERTEX_ATTRIB          = 0x8626;
161
162    /* CullFaceMode */
163    const GLenum FRONT                          = 0x0404;
164    const GLenum BACK                           = 0x0405;
165    const GLenum FRONT_AND_BACK                 = 0x0408;
166
167    /* DepthFunction */
168    /*      NEVER */
169    /*      LESS */
170    /*      EQUAL */
171    /*      LEQUAL */
172    /*      GREATER */
173    /*      NOTEQUAL */
174    /*      GEQUAL */
175    /*      ALWAYS */
176
177    /* EnableCap */
178    const GLenum TEXTURE_2D                     = 0x0DE1;
179    const GLenum CULL_FACE                      = 0x0B44;
180    const GLenum BLEND                          = 0x0BE2;
181    const GLenum DITHER                         = 0x0BD0;
182    const GLenum STENCIL_TEST                   = 0x0B90;
183    const GLenum DEPTH_TEST                     = 0x0B71;
184    const GLenum SCISSOR_TEST                   = 0x0C11;
185    const GLenum POLYGON_OFFSET_FILL            = 0x8037;
186    const GLenum SAMPLE_ALPHA_TO_COVERAGE       = 0x809E;
187    const GLenum SAMPLE_COVERAGE                = 0x80A0;
188
189    /* ErrorCode */
190    const GLenum NO_ERROR                       = 0;
191    const GLenum INVALID_ENUM                   = 0x0500;
192    const GLenum INVALID_VALUE                  = 0x0501;
193    const GLenum INVALID_OPERATION              = 0x0502;
194    const GLenum OUT_OF_MEMORY                  = 0x0505;
195
196    /* FrontFaceDirection */
197    const GLenum CW                             = 0x0900;
198    const GLenum CCW                            = 0x0901;
199
200    /* GetPName */
201    const GLenum LINE_WIDTH                     = 0x0B21;
202    const GLenum ALIASED_POINT_SIZE_RANGE       = 0x846D;
203    const GLenum ALIASED_LINE_WIDTH_RANGE       = 0x846E;
204    const GLenum CULL_FACE_MODE                 = 0x0B45;
205    const GLenum FRONT_FACE                     = 0x0B46;
206    const GLenum DEPTH_RANGE                    = 0x0B70;
207    const GLenum DEPTH_WRITEMASK                = 0x0B72;
208    const GLenum DEPTH_CLEAR_VALUE              = 0x0B73;
209    const GLenum DEPTH_FUNC                     = 0x0B74;
210    const GLenum STENCIL_CLEAR_VALUE            = 0x0B91;
211    const GLenum STENCIL_FUNC                   = 0x0B92;
212    const GLenum STENCIL_FAIL                   = 0x0B94;
213    const GLenum STENCIL_PASS_DEPTH_FAIL        = 0x0B95;
214    const GLenum STENCIL_PASS_DEPTH_PASS        = 0x0B96;
215    const GLenum STENCIL_REF                    = 0x0B97;
216    const GLenum STENCIL_VALUE_MASK             = 0x0B93;
217    const GLenum STENCIL_WRITEMASK              = 0x0B98;
218    const GLenum STENCIL_BACK_FUNC              = 0x8800;
219    const GLenum STENCIL_BACK_FAIL              = 0x8801;
220    const GLenum STENCIL_BACK_PASS_DEPTH_FAIL   = 0x8802;
221    const GLenum STENCIL_BACK_PASS_DEPTH_PASS   = 0x8803;
222    const GLenum STENCIL_BACK_REF               = 0x8CA3;
223    const GLenum STENCIL_BACK_VALUE_MASK        = 0x8CA4;
224    const GLenum STENCIL_BACK_WRITEMASK         = 0x8CA5;
225    const GLenum VIEWPORT                       = 0x0BA2;
226    const GLenum SCISSOR_BOX                    = 0x0C10;
227    /*      SCISSOR_TEST */
228    const GLenum COLOR_CLEAR_VALUE              = 0x0C22;
229    const GLenum COLOR_WRITEMASK                = 0x0C23;
230    const GLenum UNPACK_ALIGNMENT               = 0x0CF5;
231    const GLenum PACK_ALIGNMENT                 = 0x0D05;
232    const GLenum MAX_TEXTURE_SIZE               = 0x0D33;
233    const GLenum MAX_VIEWPORT_DIMS              = 0x0D3A;
234    const GLenum SUBPIXEL_BITS                  = 0x0D50;
235    const GLenum RED_BITS                       = 0x0D52;
236    const GLenum GREEN_BITS                     = 0x0D53;
237    const GLenum BLUE_BITS                      = 0x0D54;
238    const GLenum ALPHA_BITS                     = 0x0D55;
239    const GLenum DEPTH_BITS                     = 0x0D56;
240    const GLenum STENCIL_BITS                   = 0x0D57;
241    const GLenum POLYGON_OFFSET_UNITS           = 0x2A00;
242    /*      POLYGON_OFFSET_FILL */
243    const GLenum POLYGON_OFFSET_FACTOR          = 0x8038;
244    const GLenum TEXTURE_BINDING_2D             = 0x8069;
245    const GLenum SAMPLE_BUFFERS                 = 0x80A8;
246    const GLenum SAMPLES                        = 0x80A9;
247    const GLenum SAMPLE_COVERAGE_VALUE          = 0x80AA;
248    const GLenum SAMPLE_COVERAGE_INVERT         = 0x80AB;
249
250    /* GetTextureParameter */
251    /*      TEXTURE_MAG_FILTER */
252    /*      TEXTURE_MIN_FILTER */
253    /*      TEXTURE_WRAP_S */
254    /*      TEXTURE_WRAP_T */
255
256    const GLenum NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2;
257    const GLenum COMPRESSED_TEXTURE_FORMATS     = 0x86A3;
258
259    /* HintMode */
260    const GLenum DONT_CARE                      = 0x1100;
261    const GLenum FASTEST                        = 0x1101;
262    const GLenum NICEST                         = 0x1102;
263
264    /* HintTarget */
265    const GLenum GENERATE_MIPMAP_HINT            = 0x8192;
266
267    /* DataType */
268    const GLenum BYTE                           = 0x1400;
269    const GLenum UNSIGNED_BYTE                  = 0x1401;
270    const GLenum SHORT                          = 0x1402;
271    const GLenum UNSIGNED_SHORT                 = 0x1403;
272    const GLenum INT                            = 0x1404;
273    const GLenum UNSIGNED_INT                   = 0x1405;
274    const GLenum FLOAT                          = 0x1406;
275
276    /* PixelFormat */
277    const GLenum DEPTH_COMPONENT                = 0x1902;
278    const GLenum ALPHA                          = 0x1906;
279    const GLenum RGB                            = 0x1907;
280    const GLenum RGBA                           = 0x1908;
281    const GLenum LUMINANCE                      = 0x1909;
282    const GLenum LUMINANCE_ALPHA                = 0x190A;
283
284    /* PixelType */
285    /*      UNSIGNED_BYTE */
286    const GLenum UNSIGNED_SHORT_4_4_4_4         = 0x8033;
287    const GLenum UNSIGNED_SHORT_5_5_5_1         = 0x8034;
288    const GLenum UNSIGNED_SHORT_5_6_5           = 0x8363;
289
290    /* Shaders */
291    const GLenum FRAGMENT_SHADER                  = 0x8B30;
292    const GLenum VERTEX_SHADER                    = 0x8B31;
293    const GLenum MAX_VERTEX_ATTRIBS               = 0x8869;
294    const GLenum MAX_VERTEX_UNIFORM_VECTORS       = 0x8DFB;
295    const GLenum MAX_VARYING_VECTORS              = 0x8DFC;
296    const GLenum MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
297    const GLenum MAX_VERTEX_TEXTURE_IMAGE_UNITS   = 0x8B4C;
298    const GLenum MAX_TEXTURE_IMAGE_UNITS          = 0x8872;
299    const GLenum MAX_FRAGMENT_UNIFORM_VECTORS     = 0x8DFD;
300    const GLenum SHADER_TYPE                      = 0x8B4F;
301    const GLenum DELETE_STATUS                    = 0x8B80;
302    const GLenum LINK_STATUS                      = 0x8B82;
303    const GLenum VALIDATE_STATUS                  = 0x8B83;
304    const GLenum ATTACHED_SHADERS                 = 0x8B85;
305    const GLenum ACTIVE_UNIFORMS                  = 0x8B86;
306    const GLenum ACTIVE_UNIFORM_MAX_LENGTH        = 0x8B87;
307    const GLenum ACTIVE_ATTRIBUTES                = 0x8B89;
308    const GLenum ACTIVE_ATTRIBUTE_MAX_LENGTH      = 0x8B8A;
309    const GLenum SHADING_LANGUAGE_VERSION         = 0x8B8C;
310    const GLenum CURRENT_PROGRAM                  = 0x8B8D;
311
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;
321
322    /* StencilOp */
323    /*      ZERO */
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;
331
332    /* StringName */
333    const GLenum VENDOR                         = 0x1F00;
334    const GLenum RENDERER                       = 0x1F01;
335    const GLenum VERSION                        = 0x1F02;
336
337    /* TextureMagFilter */
338    const GLenum NEAREST                        = 0x2600;
339    const GLenum LINEAR                         = 0x2601;
340
341    /* TextureMinFilter */
342    /*      NEAREST */
343    /*      LINEAR */
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;
348
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;
354
355    /* TextureTarget */
356    /*      TEXTURE_2D */
357    const GLenum TEXTURE                        = 0x1702;
358
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;
368
369    /* TextureUnit */
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;
403
404    /* TextureWrapMode */
405    const GLenum REPEAT                         = 0x2901;
406    const GLenum CLAMP_TO_EDGE                  = 0x812F;
407    const GLenum MIRRORED_REPEAT                = 0x8370;
408
409    /* Uniform Types */
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;
425
426    /* Vertex Arrays */
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;
434
435    /* Shader Source */
436    const GLenum COMPILE_STATUS                 = 0x8B81;
437    const GLenum INFO_LOG_LENGTH                = 0x8B84;
438    const GLenum SHADER_SOURCE_LENGTH           = 0x8B88;
439
440    /* Shader Precision-Specified Types */
441    const GLenum LOW_FLOAT                      = 0x8DF0;
442    const GLenum MEDIUM_FLOAT                   = 0x8DF1;
443    const GLenum HIGH_FLOAT                     = 0x8DF2;
444    const GLenum LOW_INT                        = 0x8DF3;
445    const GLenum MEDIUM_INT                     = 0x8DF4;
446    const GLenum HIGH_INT                       = 0x8DF5;
447
448    /* Framebuffer Object. */
449    const GLenum FRAMEBUFFER                    = 0x8D40;
450    const GLenum RENDERBUFFER                   = 0x8D41;
451
452    const GLenum RGBA4                          = 0x8056;
453    const GLenum RGB5_A1                        = 0x8057;
454    const GLenum RGB565                         = 0x8D62;
455    const GLenum DEPTH_COMPONENT16              = 0x81A5;
456    const GLenum STENCIL_INDEX                  = 0x1901;
457    const GLenum STENCIL_INDEX8                 = 0x8D48;
458    const GLenum DEPTH_STENCIL                  = 0x84F9;
459
460    const GLenum RENDERBUFFER_WIDTH             = 0x8D42;
461    const GLenum RENDERBUFFER_HEIGHT            = 0x8D43;
462    const GLenum RENDERBUFFER_INTERNAL_FORMAT   = 0x8D44;
463    const GLenum RENDERBUFFER_RED_SIZE          = 0x8D50;
464    const GLenum RENDERBUFFER_GREEN_SIZE        = 0x8D51;
465    const GLenum RENDERBUFFER_BLUE_SIZE         = 0x8D52;
466    const GLenum RENDERBUFFER_ALPHA_SIZE        = 0x8D53;
467    const GLenum RENDERBUFFER_DEPTH_SIZE        = 0x8D54;
468    const GLenum RENDERBUFFER_STENCIL_SIZE      = 0x8D55;
469
470    const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE           = 0x8CD0;
471    const GLenum FRAMEBUFFER_ATTACHMENT_OBJECT_NAME           = 0x8CD1;
472    const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL         = 0x8CD2;
473    const GLenum FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;
474
475    const GLenum COLOR_ATTACHMENT0              = 0x8CE0;
476    const GLenum DEPTH_ATTACHMENT               = 0x8D00;
477    const GLenum STENCIL_ATTACHMENT             = 0x8D20;
478    const GLenum DEPTH_STENCIL_ATTACHMENT       = 0x821A;
479
480    const GLenum NONE                           = 0;
481
482    const GLenum FRAMEBUFFER_COMPLETE                      = 0x8CD5;
483    const GLenum FRAMEBUFFER_INCOMPLETE_ATTACHMENT         = 0x8CD6;
484    const GLenum FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
485    const GLenum FRAMEBUFFER_INCOMPLETE_DIMENSIONS         = 0x8CD9;
486    const GLenum FRAMEBUFFER_UNSUPPORTED                   = 0x8CDD;
487
488    const GLenum FRAMEBUFFER_BINDING            = 0x8CA6;
489    const GLenum RENDERBUFFER_BINDING           = 0x8CA7;
490    const GLenum MAX_RENDERBUFFER_SIZE          = 0x84E8;
491
492    const GLenum INVALID_FRAMEBUFFER_OPERATION  = 0x0506;
493
494    /* WebGL-specific enums */
495    const GLenum UNPACK_FLIP_Y_WEBGL            = 0x9240;
496    const GLenum UNPACK_PREMULTIPLY_ALPHA_WEBGL = 0x9241;
497    const GLenum CONTEXT_LOST_WEBGL             = 0x9242;
498    const GLenum UNPACK_COLORSPACE_CONVERSION_WEBGL = 0x9243;
499    const GLenum BROWSER_DEFAULT_WEBGL          = 0x9244;
500
501    readonly attribute HTMLCanvasElement canvas;
502
503    WebGLContextAttributes getContextAttributes();
504
505    boolean isContextLost();
506
507    DOMString[ ] getSupportedExtensions();
508    object getExtension(DOMString name);
509
510    void activeTexture(GLenum texture);
511    void attachShader(WebGLProgram program, WebGLShader shader);
512    void bindAttribLocation(WebGLProgram program, GLuint index, DOMString name);
513    void bindBuffer(GLenum target, WebGLBuffer buffer);
514    void bindFramebuffer(GLenum target, WebGLFramebuffer framebuffer);
515    void bindRenderbuffer(GLenum target, WebGLRenderbuffer renderbuffer);
516    void bindTexture(GLenum target, WebGLTexture texture);
517    void blendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
518    void blendEquation(GLenum mode);
519    void blendEquationSeparate(GLenum modeRGB, GLenum modeAlpha);
520    void blendFunc(GLenum sfactor, GLenum dfactor);
521    void blendFuncSeparate(GLenum srcRGB, GLenum dstRGB,
522                           GLenum srcAlpha, GLenum dstAlpha);
523
524    void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
525    void bufferData(GLenum target, ArrayBufferView data, GLenum usage);
526    void bufferData(GLenum target, ArrayBuffer data, GLenum usage);
527    void bufferSubData(GLenum target, GLintptr offset, ArrayBufferView data);
528    void bufferSubData(GLenum target, GLintptr offset, ArrayBuffer data);
529
530    GLenum checkFramebufferStatus(GLenum target);
531    void clear(GLbitfield mask);
532    void clearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha);
533    void clearDepth(GLclampf depth);
534    void clearStencil(GLint s);
535    void colorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha);
536    void compileShader(WebGLShader shader);
537
538    void copyTexImage2D(GLenum target, GLint level, GLenum internalformat,
539                        GLint x, GLint y, GLsizei width, GLsizei height,
540                        GLint border);
541    void copyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
542                           GLint x, GLint y, GLsizei width, GLsizei height);
543
544    WebGLBuffer createBuffer();
545    WebGLFramebuffer createFramebuffer();
546    WebGLProgram createProgram();
547    WebGLRenderbuffer createRenderbuffer();
548    WebGLShader createShader(GLenum type);
549    WebGLTexture createTexture();
550
551    void cullFace(GLenum mode);
552
553    void deleteBuffer(WebGLBuffer buffer);
554    void deleteFramebuffer(WebGLFramebuffer framebuffer);
555    void deleteProgram(WebGLProgram program);
556    void deleteRenderbuffer(WebGLRenderbuffer renderbuffer);
557    void deleteShader(WebGLShader shader);
558    void deleteTexture(WebGLTexture texture);
559
560    void depthFunc(GLenum func);
561    void depthMask(GLboolean flag);
562    void depthRange(GLclampf zNear, GLclampf zFar);
563    void detachShader(WebGLProgram program, WebGLShader shader);
564    void disable(GLenum cap);
565    void disableVertexAttribArray(GLuint index);
566    void drawArrays(GLenum mode, GLint first, GLsizei count);
567    void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset);
568
569    void enable(GLenum cap);
570    void enableVertexAttribArray(GLuint index);
571    void finish();
572    void flush();
573    void framebufferRenderbuffer(GLenum target, GLenum attachment,
574                                 GLenum renderbuffertarget,
575                                 WebGLRenderbuffer renderbuffer);
576    void framebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget,
577                              WebGLTexture texture, GLint level);
578    void frontFace(GLenum mode);
579
580    void generateMipmap(GLenum target);
581
582    WebGLActiveInfo getActiveAttrib(WebGLProgram program, GLuint index);
583    WebGLActiveInfo getActiveUniform(WebGLProgram program, GLuint index);
584    WebGLShader[ ] getAttachedShaders(WebGLProgram program);
585
586    GLint getAttribLocation(WebGLProgram program, DOMString name);
587
588    any getParameter(GLenum pname);
589    any getBufferParameter(GLenum target, GLenum pname);
590
591    GLenum getError();
592
593    any getFramebufferAttachmentParameter(GLenum target, GLenum attachment,
594                                          GLenum pname);
595    any getProgramParameter(WebGLProgram program, GLenum pname);
596    DOMString getProgramInfoLog(WebGLProgram program);
597    any getRenderbufferParameter(GLenum target, GLenum pname);
598    any getShaderParameter(WebGLShader shader, GLenum pname);
599    DOMString getShaderInfoLog(WebGLShader shader);
600
601    DOMString getShaderSource(WebGLShader shader);
602
603    any getTexParameter(GLenum target, GLenum pname);
604
605    any getUniform(WebGLProgram program, WebGLUniformLocation location);
606
607    WebGLUniformLocation getUniformLocation(WebGLProgram program, DOMString name);
608
609    any getVertexAttrib(GLuint index, GLenum pname);
610
611    GLsizeiptr getVertexAttribOffset(GLuint index, GLenum pname);
612
613    void hint(GLenum target, GLenum mode);
614    GLboolean isBuffer(WebGLBuffer buffer);
615    GLboolean isEnabled(GLenum cap);
616    GLboolean isFramebuffer(WebGLFramebuffer framebuffer);
617    GLboolean isProgram(WebGLProgram program);
618    GLboolean isRenderbuffer(WebGLRenderbuffer renderbuffer);
619    GLboolean isShader(WebGLShader shader);
620    GLboolean isTexture(WebGLTexture texture);
621    void lineWidth(GLfloat width);
622    void linkProgram(WebGLProgram program);
623    void pixelStorei(GLenum pname, GLint param);
624    void polygonOffset(GLfloat factor, GLfloat units);
625
626    void readPixels(GLint x, GLint y, GLsizei width, GLsizei height,
627                    GLenum format, GLenum type, ArrayBufferView pixels);
628
629    void renderbufferStorage(GLenum target, GLenum internalformat,
630                             GLsizei width, GLsizei height);
631    void sampleCoverage(GLclampf value, GLboolean invert);
632    void scissor(GLint x, GLint y, GLsizei width, GLsizei height);
633
634    void shaderSource(WebGLShader shader, DOMString source);
635
636    void stencilFunc(GLenum func, GLint ref, GLuint mask);
637    void stencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask);
638    void stencilMask(GLuint mask);
639    void stencilMaskSeparate(GLenum face, GLuint mask);
640    void stencilOp(GLenum fail, GLenum zfail, GLenum zpass);
641    void stencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass);
642
643    void texImage2D(GLenum target, GLint level, GLenum internalformat,
644                    GLsizei width, GLsizei height, GLint border, GLenum format,
645                    GLenum type, ArrayBufferView pixels);
646    void texImage2D(GLenum target, GLint level, GLenum internalformat,
647                    GLenum format, GLenum type, ImageData pixels);
648    void texImage2D(GLenum target, GLint level, GLenum internalformat,
649                    GLenum format, GLenum type, HTMLImageElement image) raises (DOMException);
650    void texImage2D(GLenum target, GLint level, GLenum internalformat,
651                    GLenum format, GLenum type, HTMLCanvasElement canvas) raises (DOMException);
652    void texImage2D(GLenum target, GLint level, GLenum internalformat,
653                    GLenum format, GLenum type, HTMLVideoElement video) raises (DOMException);
654
655    void texParameterf(GLenum target, GLenum pname, GLfloat param);
656    void texParameteri(GLenum target, GLenum pname, GLint param);
657
658    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
659                       GLsizei width, GLsizei height,
660                       GLenum format, GLenum type, ArrayBufferView pixels);
661    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
662                       GLenum format, GLenum type, ImageData pixels);
663    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
664                       GLenum format, GLenum type, HTMLImageElement image) raises (DOMException);
665    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
666                       GLenum format, GLenum type, HTMLCanvasElement canvas) raises (DOMException);
667    void texSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset,
668                       GLenum format, GLenum type, HTMLVideoElement video) raises (DOMException);
669
670    void uniform1f(WebGLUniformLocation location, GLfloat x);
671    void uniform1fv(WebGLUniformLocation location, FloatArray v);
672    void uniform1fv(WebGLUniformLocation location, sequence<float> v);
673    void uniform1i(WebGLUniformLocation location, GLint x);
674    void uniform1iv(WebGLUniformLocation location, Int32Array v);
675    void uniform1iv(WebGLUniformLocation location, sequence<long> v);
676    void uniform2f(WebGLUniformLocation location, GLfloat x, GLfloat y);
677    void uniform2fv(WebGLUniformLocation location, FloatArray v);
678    void uniform2fv(WebGLUniformLocation location, sequence<float> v);
679    void uniform2i(WebGLUniformLocation location, GLint x, GLint y);
680    void uniform2iv(WebGLUniformLocation location, Int32Array v);
681    void uniform2iv(WebGLUniformLocation location, sequence<long> v);
682    void uniform3f(WebGLUniformLocation location, GLfloat x, GLfloat y, GLfloat z);
683    void uniform3fv(WebGLUniformLocation location, FloatArray v);
684    void uniform3fv(WebGLUniformLocation location, sequence<float> v);
685    void uniform3i(WebGLUniformLocation location, GLint x, GLint y, GLint z);
686    void uniform3iv(WebGLUniformLocation location, Int32Array v);
687    void uniform3iv(WebGLUniformLocation location, sequence<long> v);
688    void uniform4f(WebGLUniformLocation location, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
689    void uniform4fv(WebGLUniformLocation location, FloatArray v);
690    void uniform4fv(WebGLUniformLocation location, sequence<float> v);
691    void uniform4i(WebGLUniformLocation location, GLint x, GLint y, GLint z, GLint w);
692    void uniform4iv(WebGLUniformLocation location, Int32Array v);
693    void uniform4iv(WebGLUniformLocation location, sequence<long> v);
694
695    void uniformMatrix2fv(WebGLUniformLocation location, GLboolean transpose,
696                          FloatArray value);
697    void uniformMatrix2fv(WebGLUniformLocation location, GLboolean transpose,
698                          sequence<float> value);
699    void uniformMatrix3fv(WebGLUniformLocation location, GLboolean transpose,
700                          FloatArray value);
701    void uniformMatrix3fv(WebGLUniformLocation location, GLboolean transpose,
702                          sequence<float> value);
703    void uniformMatrix4fv(WebGLUniformLocation location, GLboolean transpose,
704                          FloatArray value);
705    void uniformMatrix4fv(WebGLUniformLocation location, GLboolean transpose,
706                          sequence<float> value);
707
708    void useProgram(WebGLProgram program);
709    void validateProgram(WebGLProgram program);
710
711    void vertexAttrib1f(GLuint indx, GLfloat x);
712    void vertexAttrib1fv(GLuint indx, FloatArray values);
713    void vertexAttrib1fv(GLuint indx, sequence<float> values);
714    void vertexAttrib2f(GLuint indx, GLfloat x, GLfloat y);
715    void vertexAttrib2fv(GLuint indx, FloatArray values);
716    void vertexAttrib2fv(GLuint indx, sequence<float> values);
717    void vertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z);
718    void vertexAttrib3fv(GLuint indx, FloatArray values);
719    void vertexAttrib3fv(GLuint indx, sequence<float> values);
720    void vertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w);
721    void vertexAttrib4fv(GLuint indx, FloatArray values);
722    void vertexAttrib4fv(GLuint indx, sequence<float> values);
723    void vertexAttribPointer(GLuint indx, GLint size, GLenum type,
724                             GLboolean normalized, GLsizei stride, GLintptr offset);
725
726    void viewport(GLint x, GLint y, GLsizei width, GLsizei height);
727};
728
729[Constructor(DOMString type, optional WebGLContextEventInit eventInit)]
730interface WebGLContextEvent : Event {
731    readonly attribute DOMString statusMessage;
732};
733
734// EventInit is defined in the DOM4 specification.
735dictionary WebGLContextEventInit : EventInit {
736    DOMString statusMessage;
737};
738
739};
740