/*
 * Copyright (C) 2009 Apple Inc. All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 *
 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
 * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
 */

module html {

    interface [
        Conditional=3D_CANVAS,
        GenerateConstructor,
        InterfaceUUID=98fb48ae-7216-489c-862b-8e1217fc4443,
        ImplementationUUID=ab4f0781-152f-450e-9546-5b3987491a54
    ] WebGLRenderingContext : CanvasRenderingContext {

        /* ClearBufferMask */
        const unsigned int DEPTH_BUFFER_BIT               = 0x00000100;
        const unsigned int STENCIL_BUFFER_BIT             = 0x00000400;
        const unsigned int COLOR_BUFFER_BIT               = 0x00004000;

        /* Boolean */
        const unsigned int FALSE                          = 0;
        const unsigned int TRUE                           = 1;

        /* BeginMode */
        const unsigned int POINTS                         = 0x0000;
        const unsigned int LINES                          = 0x0001;
        const unsigned int LINE_LOOP                      = 0x0002;
        const unsigned int LINE_STRIP                     = 0x0003;
        const unsigned int TRIANGLES                      = 0x0004;
        const unsigned int TRIANGLE_STRIP                 = 0x0005;
        const unsigned int TRIANGLE_FAN                   = 0x0006;

        /* AlphaFunction (not supported in ES20) */
        /*      NEVER */
        /*      LESS */
        /*      EQUAL */
        /*      LEQUAL */
        /*      GREATER */
        /*      NOTEQUAL */
        /*      GEQUAL */
        /*      ALWAYS */

        /* BlendingFactorDest */
        const unsigned int ZERO                           = 0;
        const unsigned int ONE                            = 1;
        const unsigned int SRC_COLOR                      = 0x0300;
        const unsigned int ONE_MINUS_SRC_COLOR            = 0x0301;
        const unsigned int SRC_ALPHA                      = 0x0302;
        const unsigned int ONE_MINUS_SRC_ALPHA            = 0x0303;
        const unsigned int DST_ALPHA                      = 0x0304;
        const unsigned int ONE_MINUS_DST_ALPHA            = 0x0305;

        /* BlendingFactorSrc */
        /*      ZERO */
        /*      ONE */
        const unsigned int DST_COLOR                      = 0x0306;
        const unsigned int ONE_MINUS_DST_COLOR            = 0x0307;
        const unsigned int SRC_ALPHA_SATURATE             = 0x0308;
        /*      SRC_ALPHA */
        /*      ONE_MINUS_SRC_ALPHA */
        /*      DST_ALPHA */
        /*      ONE_MINUS_DST_ALPHA */

        /* BlendEquationSeparate */
        const unsigned int FUNC_ADD                       = 0x8006;
        const unsigned int BLEND_EQUATION                 = 0x8009;
        const unsigned int BLEND_EQUATION_RGB             = 0x8009;   /* same as BLEND_EQUATION */
        const unsigned int BLEND_EQUATION_ALPHA           = 0x883D;

        /* BlendSubtract */
        const unsigned int FUNC_SUBTRACT                  = 0x800A;
        const unsigned int FUNC_REVERSE_SUBTRACT          = 0x800B;

        /* Separate Blend Functions */
        const unsigned int BLEND_DST_RGB                  = 0x80C8;
        const unsigned int BLEND_SRC_RGB                  = 0x80C9;
        const unsigned int BLEND_DST_ALPHA                = 0x80CA;
        const unsigned int BLEND_SRC_ALPHA                = 0x80CB;
        const unsigned int CONSTANT_COLOR                 = 0x8001;
        const unsigned int ONE_MINUS_CONSTANT_COLOR       = 0x8002;
        const unsigned int CONSTANT_ALPHA                 = 0x8003;
        const unsigned int ONE_MINUS_CONSTANT_ALPHA       = 0x8004;
        const unsigned int BLEND_COLOR                    = 0x8005;

        /* Buffer Objects */
        const unsigned int ARRAY_BUFFER                   = 0x8892;
        const unsigned int ELEMENT_ARRAY_BUFFER           = 0x8893;
        const unsigned int ARRAY_BUFFER_BINDING           = 0x8894;
        const unsigned int ELEMENT_ARRAY_BUFFER_BINDING   = 0x8895;

        const unsigned int STREAM_DRAW                    = 0x88E0;
        const unsigned int STATIC_DRAW                    = 0x88E4;
        const unsigned int DYNAMIC_DRAW                   = 0x88E8;

        const unsigned int BUFFER_SIZE                    = 0x8764;
        const unsigned int BUFFER_USAGE                   = 0x8765;

        const unsigned int CURRENT_VERTEX_ATTRIB          = 0x8626;

        /* CullFaceMode */
        const unsigned int FRONT                          = 0x0404;
        const unsigned int BACK                           = 0x0405;
        const unsigned int FRONT_AND_BACK                 = 0x0408;

        /* DepthFunction */
        /*      NEVER */
        /*      LESS */
        /*      EQUAL */
        /*      LEQUAL */
        /*      GREATER */
        /*      NOTEQUAL */
        /*      GEQUAL */
        /*      ALWAYS */

        /* EnableCap */
        const unsigned int TEXTURE_2D                     = 0x0DE1;
        const unsigned int CULL_FACE                      = 0x0B44;
        const unsigned int BLEND                          = 0x0BE2;
        const unsigned int DITHER                         = 0x0BD0;
        const unsigned int STENCIL_TEST                   = 0x0B90;
        const unsigned int DEPTH_TEST                     = 0x0B71;
        const unsigned int SCISSOR_TEST                   = 0x0C11;
        const unsigned int POLYGON_OFFSET_FILL            = 0x8037;
        const unsigned int SAMPLE_ALPHA_TO_COVERAGE       = 0x809E;
        const unsigned int SAMPLE_COVERAGE                = 0x80A0;

        /* ErrorCode */
        const unsigned int NO_ERROR                       = 0;
        const unsigned int INVALID_ENUM                   = 0x0500;
        const unsigned int INVALID_VALUE                  = 0x0501;
        const unsigned int INVALID_OPERATION              = 0x0502;
        const unsigned int OUT_OF_MEMORY                  = 0x0505;

        /* FrontFaceDirection */
        const unsigned int CW                             = 0x0900;
        const unsigned int CCW                            = 0x0901;

        /* GetPName */
        const unsigned int LINE_WIDTH                     = 0x0B21;
        const unsigned int ALIASED_POINT_SIZE_RANGE       = 0x846D;
        const unsigned int ALIASED_LINE_WIDTH_RANGE       = 0x846E;
        const unsigned int CULL_FACE_MODE                 = 0x0B45;
        const unsigned int FRONT_FACE                     = 0x0B46;
        const unsigned int DEPTH_RANGE                    = 0x0B70;
        const unsigned int DEPTH_WRITEMASK                = 0x0B72;
        const unsigned int DEPTH_CLEAR_VALUE              = 0x0B73;
        const unsigned int DEPTH_FUNC                     = 0x0B74;
        const unsigned int STENCIL_CLEAR_VALUE            = 0x0B91;
        const unsigned int STENCIL_FUNC                   = 0x0B92;
        const unsigned int STENCIL_FAIL                   = 0x0B94;
        const unsigned int STENCIL_PASS_DEPTH_FAIL        = 0x0B95;
        const unsigned int STENCIL_PASS_DEPTH_PASS        = 0x0B96;
        const unsigned int STENCIL_REF                    = 0x0B97;
        const unsigned int STENCIL_VALUE_MASK             = 0x0B93;
        const unsigned int STENCIL_WRITEMASK              = 0x0B98;
        const unsigned int STENCIL_BACK_FUNC              = 0x8800;
        const unsigned int STENCIL_BACK_FAIL              = 0x8801;
        const unsigned int STENCIL_BACK_PASS_DEPTH_FAIL   = 0x8802;
        const unsigned int STENCIL_BACK_PASS_DEPTH_PASS   = 0x8803;
        const unsigned int STENCIL_BACK_REF               = 0x8CA3;
        const unsigned int STENCIL_BACK_VALUE_MASK        = 0x8CA4;
        const unsigned int STENCIL_BACK_WRITEMASK         = 0x8CA5;
        const unsigned int VIEWPORT                       = 0x0BA2;
        const unsigned int SCISSOR_BOX                    = 0x0C10;
        /*      SCISSOR_TEST */
        const unsigned int COLOR_CLEAR_VALUE              = 0x0C22;
        const unsigned int COLOR_WRITEMASK                = 0x0C23;
        const unsigned int UNPACK_ALIGNMENT               = 0x0CF5;
        const unsigned int PACK_ALIGNMENT                 = 0x0D05;
        const unsigned int MAX_TEXTURE_SIZE               = 0x0D33;
        const unsigned int MAX_VIEWPORT_DIMS              = 0x0D3A;
        const unsigned int SUBPIXEL_BITS                  = 0x0D50;
        const unsigned int RED_BITS                       = 0x0D52;
        const unsigned int GREEN_BITS                     = 0x0D53;
        const unsigned int BLUE_BITS                      = 0x0D54;
        const unsigned int ALPHA_BITS                     = 0x0D55;
        const unsigned int DEPTH_BITS                     = 0x0D56;
        const unsigned int STENCIL_BITS                   = 0x0D57;
        const unsigned int POLYGON_OFFSET_UNITS           = 0x2A00;
        /*      POLYGON_OFFSET_FILL */
        const unsigned int POLYGON_OFFSET_FACTOR          = 0x8038;
        const unsigned int TEXTURE_BINDING_2D             = 0x8069;
        const unsigned int SAMPLE_BUFFERS                 = 0x80A8;
        const unsigned int SAMPLES                        = 0x80A9;
        const unsigned int SAMPLE_COVERAGE_VALUE          = 0x80AA;
        const unsigned int SAMPLE_COVERAGE_INVERT         = 0x80AB;

        /* GetTextureParameter */
        /*      TEXTURE_MAG_FILTER */
        /*      TEXTURE_MIN_FILTER */
        /*      TEXTURE_WRAP_S */
        /*      TEXTURE_WRAP_T */

        const unsigned int NUM_COMPRESSED_TEXTURE_FORMATS = 0x86A2;
        const unsigned int COMPRESSED_TEXTURE_FORMATS     = 0x86A3;

        /* HintMode */
        const unsigned int DONT_CARE                      = 0x1100;
        const unsigned int FASTEST                        = 0x1101;
        const unsigned int NICEST                         = 0x1102;

        /* HintTarget */
        const unsigned int GENERATE_MIPMAP_HINT            = 0x8192;

        /* DataType */
        const unsigned int BYTE                           = 0x1400;
        const unsigned int UNSIGNED_BYTE                  = 0x1401;
        const unsigned int SHORT                          = 0x1402;
        const unsigned int UNSIGNED_SHORT                 = 0x1403;
        const unsigned int INT                            = 0x1404;
        const unsigned int UNSIGNED_INT                   = 0x1405;
        const unsigned int FLOAT                          = 0x1406;
        const unsigned int FIXED                          = 0x140C;

        /* PixelFormat */
        const unsigned int DEPTH_COMPONENT                = 0x1902;
        const unsigned int ALPHA                          = 0x1906;
        const unsigned int RGB                            = 0x1907;
        const unsigned int RGBA                           = 0x1908;
        const unsigned int LUMINANCE                      = 0x1909;
        const unsigned int LUMINANCE_ALPHA                = 0x190A;

        /* PixelType */
        /*      UNSIGNED_BYTE */
        const unsigned int UNSIGNED_SHORT_4_4_4_4         = 0x8033;
        const unsigned int UNSIGNED_SHORT_5_5_5_1         = 0x8034;
        const unsigned int UNSIGNED_SHORT_5_6_5           = 0x8363;

        /* Shaders */
        const unsigned int FRAGMENT_SHADER                  = 0x8B30;
        const unsigned int VERTEX_SHADER                    = 0x8B31;
        const unsigned int MAX_VERTEX_ATTRIBS               = 0x8869;
        const unsigned int MAX_VERTEX_UNIFORM_VECTORS       = 0x8DFB;
        const unsigned int MAX_VARYING_VECTORS              = 0x8DFC;
        const unsigned int MAX_COMBINED_TEXTURE_IMAGE_UNITS = 0x8B4D;
        const unsigned int MAX_VERTEX_TEXTURE_IMAGE_UNITS   = 0x8B4C;
        const unsigned int MAX_TEXTURE_IMAGE_UNITS          = 0x8872;
        const unsigned int MAX_FRAGMENT_UNIFORM_VECTORS     = 0x8DFD;
        const unsigned int SHADER_TYPE                      = 0x8B4F;
        const unsigned int DELETE_STATUS                    = 0x8B80;
        const unsigned int LINK_STATUS                      = 0x8B82;
        const unsigned int VALIDATE_STATUS                  = 0x8B83;
        const unsigned int ATTACHED_SHADERS                 = 0x8B85;
        const unsigned int ACTIVE_UNIFORMS                  = 0x8B86;
        const unsigned int ACTIVE_UNIFORM_MAX_LENGTH        = 0x8B87;
        const unsigned int ACTIVE_ATTRIBUTES                = 0x8B89;
        const unsigned int ACTIVE_ATTRIBUTE_MAX_LENGTH      = 0x8B8A;
        const unsigned int SHADING_LANGUAGE_VERSION         = 0x8B8C;
        const unsigned int CURRENT_PROGRAM                  = 0x8B8D;

        /* StencilFunction */
        const unsigned int NEVER                          = 0x0200;
        const unsigned int LESS                           = 0x0201;
        const unsigned int EQUAL                          = 0x0202;
        const unsigned int LEQUAL                         = 0x0203;
        const unsigned int GREATER                        = 0x0204;
        const unsigned int NOTEQUAL                       = 0x0205;
        const unsigned int GEQUAL                         = 0x0206;
        const unsigned int ALWAYS                         = 0x0207;

        /* StencilOp */
        /*      ZERO */
        const unsigned int KEEP                           = 0x1E00;
        const unsigned int REPLACE                        = 0x1E01;
        const unsigned int INCR                           = 0x1E02;
        const unsigned int DECR                           = 0x1E03;
        const unsigned int INVERT                         = 0x150A;
        const unsigned int INCR_WRAP                      = 0x8507;
        const unsigned int DECR_WRAP                      = 0x8508;

        /* StringName */
        const unsigned int VENDOR                         = 0x1F00;
        const unsigned int RENDERER                       = 0x1F01;
        const unsigned int VERSION                        = 0x1F02;
        const unsigned int EXTENSIONS                     = 0x1F03;

        /* TextureMagFilter */
        const unsigned int NEAREST                        = 0x2600;
        const unsigned int LINEAR                         = 0x2601;

        /* TextureMinFilter */
        /*      NEAREST */
        /*      LINEAR */
        const unsigned int NEAREST_MIPMAP_NEAREST         = 0x2700;
        const unsigned int LINEAR_MIPMAP_NEAREST          = 0x2701;
        const unsigned int NEAREST_MIPMAP_LINEAR          = 0x2702;
        const unsigned int LINEAR_MIPMAP_LINEAR           = 0x2703;

        /* TextureParameterName */
        const unsigned int TEXTURE_MAG_FILTER             = 0x2800;
        const unsigned int TEXTURE_MIN_FILTER             = 0x2801;
        const unsigned int TEXTURE_WRAP_S                 = 0x2802;
        const unsigned int TEXTURE_WRAP_T                 = 0x2803;

        /* TextureTarget */
        /*      TEXTURE_2D */
        const unsigned int TEXTURE                        = 0x1702;

        const unsigned int TEXTURE_CUBE_MAP               = 0x8513;
        const unsigned int TEXTURE_BINDING_CUBE_MAP       = 0x8514;
        const unsigned int TEXTURE_CUBE_MAP_POSITIVE_X    = 0x8515;
        const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_X    = 0x8516;
        const unsigned int TEXTURE_CUBE_MAP_POSITIVE_Y    = 0x8517;
        const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_Y    = 0x8518;
        const unsigned int TEXTURE_CUBE_MAP_POSITIVE_Z    = 0x8519;
        const unsigned int TEXTURE_CUBE_MAP_NEGATIVE_Z    = 0x851A;
        const unsigned int MAX_CUBE_MAP_TEXTURE_SIZE      = 0x851C;

        /* TextureUnit */
        const unsigned int TEXTURE0                       = 0x84C0;
        const unsigned int TEXTURE1                       = 0x84C1;
        const unsigned int TEXTURE2                       = 0x84C2;
        const unsigned int TEXTURE3                       = 0x84C3;
        const unsigned int TEXTURE4                       = 0x84C4;
        const unsigned int TEXTURE5                       = 0x84C5;
        const unsigned int TEXTURE6                       = 0x84C6;
        const unsigned int TEXTURE7                       = 0x84C7;
        const unsigned int TEXTURE8                       = 0x84C8;
        const unsigned int TEXTURE9                       = 0x84C9;
        const unsigned int TEXTURE10                      = 0x84CA;
        const unsigned int TEXTURE11                      = 0x84CB;
        const unsigned int TEXTURE12                      = 0x84CC;
        const unsigned int TEXTURE13                      = 0x84CD;
        const unsigned int TEXTURE14                      = 0x84CE;
        const unsigned int TEXTURE15                      = 0x84CF;
        const unsigned int TEXTURE16                      = 0x84D0;
        const unsigned int TEXTURE17                      = 0x84D1;
        const unsigned int TEXTURE18                      = 0x84D2;
        const unsigned int TEXTURE19                      = 0x84D3;
        const unsigned int TEXTURE20                      = 0x84D4;
        const unsigned int TEXTURE21                      = 0x84D5;
        const unsigned int TEXTURE22                      = 0x84D6;
        const unsigned int TEXTURE23                      = 0x84D7;
        const unsigned int TEXTURE24                      = 0x84D8;
        const unsigned int TEXTURE25                      = 0x84D9;
        const unsigned int TEXTURE26                      = 0x84DA;
        const unsigned int TEXTURE27                      = 0x84DB;
        const unsigned int TEXTURE28                      = 0x84DC;
        const unsigned int TEXTURE29                      = 0x84DD;
        const unsigned int TEXTURE30                      = 0x84DE;
        const unsigned int TEXTURE31                      = 0x84DF;
        const unsigned int ACTIVE_TEXTURE                 = 0x84E0;

        /* TextureWrapMode */
        const unsigned int REPEAT                         = 0x2901;
        const unsigned int CLAMP_TO_EDGE                  = 0x812F;
        const unsigned int MIRRORED_REPEAT                = 0x8370;

        /* Uniform Types */
        const unsigned int FLOAT_VEC2                     = 0x8B50;
        const unsigned int FLOAT_VEC3                     = 0x8B51;
        const unsigned int FLOAT_VEC4                     = 0x8B52;
        const unsigned int INT_VEC2                       = 0x8B53;
        const unsigned int INT_VEC3                       = 0x8B54;
        const unsigned int INT_VEC4                       = 0x8B55;
        const unsigned int BOOL                           = 0x8B56;
        const unsigned int BOOL_VEC2                      = 0x8B57;
        const unsigned int BOOL_VEC3                      = 0x8B58;
        const unsigned int BOOL_VEC4                      = 0x8B59;
        const unsigned int FLOAT_MAT2                     = 0x8B5A;
        const unsigned int FLOAT_MAT3                     = 0x8B5B;
        const unsigned int FLOAT_MAT4                     = 0x8B5C;
        const unsigned int SAMPLER_2D                     = 0x8B5E;
        const unsigned int SAMPLER_CUBE                   = 0x8B60;

        /* Vertex Arrays */
        const unsigned int VERTEX_ATTRIB_ARRAY_ENABLED        = 0x8622;
        const unsigned int VERTEX_ATTRIB_ARRAY_SIZE           = 0x8623;
        const unsigned int VERTEX_ATTRIB_ARRAY_STRIDE         = 0x8624;
        const unsigned int VERTEX_ATTRIB_ARRAY_TYPE           = 0x8625;
        const unsigned int VERTEX_ATTRIB_ARRAY_NORMALIZED     = 0x886A;
        const unsigned int VERTEX_ATTRIB_ARRAY_POINTER        = 0x8645;
        const unsigned int VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;

        /* Read Format */
        const unsigned int IMPLEMENTATION_COLOR_READ_TYPE   = 0x8B9A;
        const unsigned int IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B;

        /* Shader Source */
        const unsigned int COMPILE_STATUS                 = 0x8B81;
        const unsigned int INFO_LOG_LENGTH                = 0x8B84;
        const unsigned int SHADER_SOURCE_LENGTH           = 0x8B88;
        const unsigned int SHADER_COMPILER                = 0x8DFA;

        /* Shader Binary */
        const unsigned int SHADER_BINARY_FORMATS          = 0x8DF8;
        const unsigned int NUM_SHADER_BINARY_FORMATS      = 0x8DF9;

        /* Shader Precision-Specified Types */
        const unsigned int LOW_FLOAT                      = 0x8DF0;
        const unsigned int MEDIUM_FLOAT                   = 0x8DF1;
        const unsigned int HIGH_FLOAT                     = 0x8DF2;
        const unsigned int LOW_INT                        = 0x8DF3;
        const unsigned int MEDIUM_INT                     = 0x8DF4;
        const unsigned int HIGH_INT                       = 0x8DF5;

        /* Framebuffer Object. */
        const unsigned int FRAMEBUFFER                    = 0x8D40;
        const unsigned int RENDERBUFFER                   = 0x8D41;

        const unsigned int RGBA4                          = 0x8056;
        const unsigned int RGB5_A1                        = 0x8057;
        const unsigned int RGB565                         = 0x8D62;
        const unsigned int DEPTH_COMPONENT16              = 0x81A5;
        const unsigned int STENCIL_INDEX                  = 0x1901;
        const unsigned int STENCIL_INDEX8                 = 0x8D48;

        const unsigned int RENDERBUFFER_WIDTH             = 0x8D42;
        const unsigned int RENDERBUFFER_HEIGHT            = 0x8D43;
        const unsigned int RENDERBUFFER_INTERNAL_FORMAT   = 0x8D44;
        const unsigned int RENDERBUFFER_RED_SIZE          = 0x8D50;
        const unsigned int RENDERBUFFER_GREEN_SIZE        = 0x8D51;
        const unsigned int RENDERBUFFER_BLUE_SIZE         = 0x8D52;
        const unsigned int RENDERBUFFER_ALPHA_SIZE        = 0x8D53;
        const unsigned int RENDERBUFFER_DEPTH_SIZE        = 0x8D54;
        const unsigned int RENDERBUFFER_STENCIL_SIZE      = 0x8D55;

        const unsigned int FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE           = 0x8CD0;
        const unsigned int FRAMEBUFFER_ATTACHMENT_OBJECT_NAME           = 0x8CD1;
        const unsigned int FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL         = 0x8CD2;
        const unsigned int FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE = 0x8CD3;

        const unsigned int COLOR_ATTACHMENT0              = 0x8CE0;
        const unsigned int DEPTH_ATTACHMENT               = 0x8D00;
        const unsigned int STENCIL_ATTACHMENT             = 0x8D20;

        const unsigned int NONE                           = 0;

        const unsigned int FRAMEBUFFER_COMPLETE                      = 0x8CD5;
        const unsigned int FRAMEBUFFER_INCOMPLETE_ATTACHMENT         = 0x8CD6;
        const unsigned int FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT = 0x8CD7;
        const unsigned int FRAMEBUFFER_INCOMPLETE_DIMENSIONS         = 0x8CD9;
        const unsigned int FRAMEBUFFER_UNSUPPORTED                   = 0x8CDD;

        const unsigned int FRAMEBUFFER_BINDING            = 0x8CA6;
        const unsigned int RENDERBUFFER_BINDING           = 0x8CA7;
        const unsigned int MAX_RENDERBUFFER_SIZE          = 0x84E8;

        const unsigned int INVALID_FRAMEBUFFER_OPERATION  = 0x0506;

        long sizeInBytes(in unsigned long type) raises(DOMException);

        void         activeTexture(in unsigned long texture) raises(DOMException);
        void         attachShader(in WebGLProgram program, in WebGLShader shader) raises(DOMException);
        void         bindAttribLocation(in WebGLProgram program, in unsigned long index, in DOMString name) raises(DOMException);
        void         bindBuffer(in unsigned long target, in WebGLBuffer buffer) raises(DOMException);
        void         bindFramebuffer(in unsigned long target, in WebGLFramebuffer framebuffer) raises(DOMException);
        void         bindRenderbuffer(in unsigned long target, in WebGLRenderbuffer renderbuffer) raises(DOMException);
        void         bindTexture(in unsigned long target, in WebGLTexture texture) raises(DOMException);
        void         blendColor(in double red, in double green, in double blue, in double alpha);
        void         blendEquation( in unsigned long mode );
        void         blendEquationSeparate(in unsigned long modeRGB, in unsigned long modeAlpha);
        void         blendFunc(in unsigned long sfactor, in unsigned long dfactor);
        void         blendFuncSeparate(in unsigned long srcRGB, in unsigned long dstRGB, in unsigned long srcAlpha, in unsigned long dstAlpha);

        // Supported forms:
        //   void bufferData (in GLenum target, in GLsizei size, in GLenum usage);
        //   void bufferData (in GLenum target, in WebGLArray data, in GLenum usage);
        [Custom] void bufferData() raises(DOMException);
        // Supported forms:
        //   void bufferSubData (in GLenum target, in GLsizeiptr offset, in WebGLArray data);
        [Custom] void bufferSubData() raises(DOMException);

        unsigned long checkFramebufferStatus(in unsigned long target);
        void         clear(in unsigned long mask);
        void         clearColor(in double red, in double green, in double blue, in double alpha);
        void         clearDepth(in double depth);
        void         clearStencil(in long s);
        void         colorMask(in boolean red, in boolean green, in boolean blue, in boolean alpha);
        void         compileShader(in WebGLShader shader) raises(DOMException);
        
        //void         compressedTexImage2D(in unsigned long target, in long level, in unsigned long internalformat, in unsigned long width, in unsigned long height, in long border, in unsigned long imageSize, const void* data);
        //void         compressedTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in unsigned long width, in unsigned long height, in unsigned long format, in unsigned long imageSize, const void* data);
        
        void         copyTexImage2D(in unsigned long target, in long level, in unsigned long internalformat, in long x, in long y, in unsigned long width, in unsigned long height, in long border);
        void         copyTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in long x, in long y, in unsigned long width, in unsigned long height);

        WebGLBuffer createBuffer();
        WebGLFramebuffer createFramebuffer();
        WebGLProgram createProgram();
        WebGLRenderbuffer createRenderbuffer();
        WebGLShader createShader(in unsigned long type) raises(DOMException);
        WebGLTexture createTexture();

        void         cullFace(in unsigned long mode);

        void         deleteBuffer(in WebGLBuffer buffer);
        void         deleteFramebuffer(in WebGLFramebuffer framebuffer);
        void         deleteProgram(in WebGLProgram program);
        void         deleteRenderbuffer(in WebGLRenderbuffer renderbuffer);
        void         deleteShader(in WebGLShader shader);
        void         deleteTexture(in WebGLTexture texture);

        void         depthFunc(in unsigned long func);
        void         depthMask(in boolean flag);
        // FIXME: this differs from the current WebGL spec (depthRangef)
        void         depthRange(in double zNear, in double zFar);
        void         detachShader(in WebGLProgram program, in WebGLShader shader) raises(DOMException);
        void         disable(in unsigned long cap);
        void         disableVertexAttribArray(in unsigned long index) raises(DOMException);
        void         drawArrays(in unsigned long mode, in long first, in unsigned long count) raises(DOMException);
        void         drawElements (in unsigned long mode, in long count, in unsigned long type, in unsigned long offset) raises(DOMException);

        void         enable(in unsigned long cap);
        void         enableVertexAttribArray(in unsigned long index) raises(DOMException);
        void         finish();
        void         flush();
        void         framebufferRenderbuffer(in unsigned long target, in unsigned long attachment, in unsigned long renderbuffertarget, in WebGLRenderbuffer renderbuffer) raises(DOMException);
        void         framebufferTexture2D(in unsigned long target, in unsigned long attachment, in unsigned long textarget, in WebGLTexture texture, in long level) raises(DOMException);
        void         frontFace(in unsigned long mode);
        void         generateMipmap(in unsigned long target);
        
        WebGLActiveInfo getActiveAttrib(in WebGLProgram program, in unsigned long index)
            raises (DOMException);
        WebGLActiveInfo getActiveUniform(in WebGLProgram program, in unsigned long index)
            raises (DOMException);

        // WebGLShaderArray glGetAttachedShaders(GLuint program);

        int          getAttribLocation(in WebGLProgram program, in DOMString name);

        // any getBufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException);
        [Custom] void getBufferParameter();

        unsigned long getError();

        // any getFramebufferAttachmentParameter(in unsigned long target, in unsigned long attachment, in unsigned long pname) raises(DOMException);
        [Custom] void getFramebufferAttachmentParameter();
        // any getParameter(in unsigned long pname) raises(DOMException);
        [Custom] void getParameter();
        // any getProgramParameter(in WebGLProgram program, in unsigned long pname) raises(DOMException);
        [Custom] void getProgramParameter();
        DOMString getProgramInfoLog(in WebGLProgram program) raises(DOMException);
        // any getRenderbufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException);
        [Custom] void getRenderbufferParameter();
        // any getShaderParameter(in WebGLShader shader, in unsigned long pname) raises(DOMException);
        [Custom] void getShaderParameter() raises(DOMException);

        DOMString    getShaderInfoLog(in WebGLShader shader) raises(DOMException);

        // TBD
        // void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);

        DOMString    getShaderSource(in WebGLShader shader) raises(DOMException);
        DOMString    getString(in unsigned long name);

        // any getTexParameter(in unsigned long target, in unsigned long pname) raises(DOMException);
        [Custom] void getTexParameter();

        // any getUniform(in WebGLProgram program, in WebGLUniformLocation location) raises(DOMException);
        [Custom] void getUniform();

        WebGLUniformLocation getUniformLocation(in WebGLProgram program, in DOMString name) raises(DOMException);

        // any getVertexAttrib(in unsigned long index, in unsigned long pname) raises(DOMException);
        [Custom] void getVertexAttrib();

        long getVertexAttribOffset(in unsigned long index, in unsigned long pname);

        void         hint(in unsigned long target, in unsigned long mode);
        boolean      isBuffer(in WebGLBuffer buffer);
        boolean      isEnabled(in unsigned long cap);
        boolean      isFramebuffer(in WebGLFramebuffer framebuffer);
        boolean      isProgram(in WebGLProgram program);
        boolean      isRenderbuffer(in WebGLRenderbuffer renderbuffer);
        boolean      isShader(in WebGLShader shader);
        boolean      isTexture(in WebGLTexture texture);
        void         lineWidth(in double width);
        void         linkProgram(in WebGLProgram program) raises(DOMException);
        void         pixelStorei(in unsigned long pname, in long param);
        void         polygonOffset(in double factor, in double units);

        WebGLArray readPixels(in long x, in long y, in unsigned long width, in unsigned long height, in unsigned long format, in unsigned long type);
        
        void         releaseShaderCompiler();
        void         renderbufferStorage(in unsigned long target, in unsigned long internalformat, in unsigned long width, in unsigned long height);
        void         sampleCoverage(in double value, in boolean invert);
        void         scissor(in long x, in long y, in unsigned long width, in unsigned long height);
        void         shaderSource(in WebGLShader shader, in DOMString string) raises(DOMException);
        void         stencilFunc(in unsigned long func, in long ref, in unsigned long mask);
        void         stencilFuncSeparate(in unsigned long face, in unsigned long func, in long ref, in unsigned long mask);
        void         stencilMask(in unsigned long mask);
        void         stencilMaskSeparate(in unsigned long face, in unsigned long mask);
        void         stencilOp(in unsigned long fail, in unsigned long zfail, in unsigned long zpass);
        void         stencilOpSeparate(in unsigned long face, in unsigned long fail, in unsigned long zfail, in unsigned long zpass);

        void         texParameterf(in unsigned long target, in unsigned long pname, in float param);
        void         texParameteri(in unsigned long target, in unsigned long pname, in long param);

        // Supported forms:
        //   void texImage2D(in GLenum target, in GLint level, in GLenum internalformat, in GLsizei width, in GLsizei height, 
        //                   in GLint border, in GLenum format, in GLenum type, in WebGLArray pixels);
        //   void texImage2D(in GLenum target, in GLint level, in GLenum internalformat, in GLsizei width, in GLsizei height, 
        //                   in GLint border, in GLenum format, in GLenum type, in ImageData pixels);
        //   void texImage2D(in GLenum target, in GLint level, in HTMLImageElement image,
        //                   [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha);
        //   void texImage2D(in GLenum target, in GLint level, in HTMLCanvasElement canvas,
        //                   [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha);
        //   void texImage2D(in GLenum target, in GLint level, in HTMLVideoElement video,
        //                   [Optional] in GLboolean flipY, [Optional] in premultiplyAlpha);
        [Custom] void texImage2D();

        // Supported forms:
        //   void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, 
        //                      in GLsizei width, in GLsizei height, 
        //                      in GLenum format, in GLenum type, in WebGLArray pixels);
        //   void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, 
        //                      in GLsizei width, in GLsizei height, 
        //                      in GLenum format, in GLenum type, in ImageData pixels);
        //   void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, 
        //                      in GLsizei width, in GLsizei height, in HTMLImageElement image,
        //                      [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
        //   void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, 
        //                      in GLsizei width, in GLsizei height, in HTMLCanvasElement canvas,
        //                      [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
        //   void texSubImage2D(in GLenum target, in GLint level, in GLint xoffset, in GLint yoffset, 
        //                      in GLsizei width, in GLsizei height, in HTMLVideoElement video,
        //                      [Optional] GLboolean flipY, [Optional] in premultiplyAlpha);
        [Custom] void texSubImage2D();

        void uniform1f(in WebGLUniformLocation location, in float x) raises(DOMException);
        [Custom] void uniform1fv(in WebGLUniformLocation location, in WebGLFloatArray v) raises(DOMException);
        void uniform1i(in WebGLUniformLocation location, in long x) raises(DOMException);
        [Custom] void uniform1iv(in WebGLUniformLocation location, in WebGLIntArray v) raises(DOMException);
        void uniform2f(in WebGLUniformLocation location, in float x, in float y) raises(DOMException);
        [Custom] void uniform2fv(in WebGLUniformLocation location, in WebGLFloatArray v) raises(DOMException);
        void uniform2i(in WebGLUniformLocation location, in long x, in long y) raises(DOMException);
        [Custom] void uniform2iv(in WebGLUniformLocation location, in WebGLIntArray v) raises(DOMException);
        void uniform3f(in WebGLUniformLocation location, in float x, in float y, in float z) raises(DOMException);
        [Custom] void uniform3fv(in WebGLUniformLocation location, in WebGLFloatArray v) raises(DOMException);
        void uniform3i(in WebGLUniformLocation location, in long x, in long y, in long z) raises(DOMException);
        [Custom] void uniform3iv(in WebGLUniformLocation location, in WebGLIntArray v) raises(DOMException);
        void uniform4f(in WebGLUniformLocation location, in float x, in float y, in float z, in float w) raises(DOMException);
        [Custom] void uniform4fv(in WebGLUniformLocation location, in WebGLFloatArray v) raises(DOMException);
        void uniform4i(in WebGLUniformLocation location, in long x, in long y, in long z, in long w) raises(DOMException);
        [Custom] void uniform4iv(in WebGLUniformLocation location, in WebGLIntArray v) raises(DOMException);

        [Custom] void uniformMatrix2fv(in WebGLUniformLocation location, in boolean transpose, in WebGLFloatArray array) raises(DOMException);
        [Custom] void uniformMatrix3fv(in WebGLUniformLocation location, in boolean transpose, in WebGLFloatArray array) raises(DOMException);
        [Custom] void uniformMatrix4fv(in WebGLUniformLocation location, in boolean transpose, in WebGLFloatArray array) raises(DOMException);

        void         useProgram(in WebGLProgram program) raises(DOMException);
        void         validateProgram(in WebGLProgram program) raises(DOMException);

        void         vertexAttrib1f(in unsigned long indx, in float x);
        [Custom] void         vertexAttrib1fv(in unsigned long indx, in WebGLFloatArray values);
        void         vertexAttrib2f(in unsigned long indx, in float x, in float y);
        [Custom] void         vertexAttrib2fv(in unsigned long indx, in WebGLFloatArray values);
        void         vertexAttrib3f(in unsigned long indx, in float x, in float y, in float z);
        [Custom] void         vertexAttrib3fv(in unsigned long indx, in WebGLFloatArray values);
        void         vertexAttrib4f(in unsigned long indx, in float x, in float y, in float z, in float w);
        [Custom] void         vertexAttrib4fv(in unsigned long indx, in WebGLFloatArray values);
        void         vertexAttribPointer(in unsigned long indx, in long size, in unsigned long type, in boolean normalized, 
                                         in long stride, in unsigned long offset) raises(DOMException);

        void         viewport(in long x, in long y, in unsigned long width, in unsigned long height);
    };
}

