# WebGL > ![icon-note.gif](public_sys-resources/icon-note.gif) **Note:** > The initial APIs of this module are supported since API version 7. Newly added APIs will be marked with a superscript to indicate their earliest API version. This module provides WebGL APIs that correspond to the OpenGL ES 2.0 feature set. For more information, see [WebGLâ„¢](https://www.khronos.org/registry/webgl/specs/latest/1.0/). ## Modules to Import ``` import webgl from 'ohos.webglnapi' ``` ## System Capabilities SystemCapability.Graphic.Graphic2D.WebGL ## Invoking Method ``` // Obtain the component instance. const el = this.$refs.canvas // Obtain the WebGL context from the component instance. const gl = el.getContext('webgl'); // Call the WebGL API. gl.clearColor(0.0, 0.0, 0.0, 1.0); gl.flush(); ``` ## GLenum | Name| Type| | -------- | -------- | | GLenum | number | ## GLboolean | Name| Type| | -------- | -------- | | GLboolean | boolean | ## GLbitfield | Name| Type| | -------- | -------- | | GLbitfield | number | ## GLbyte | Name| Type| | -------- | -------- | | GLbyte | number | ## GLshort | Name| Type| | -------- | -------- | | GLshort | number | ## GLint | Name| Type| | -------- | -------- | | GLint | number | ## GLsizei | Name| Type| | -------- | -------- | | GLsizei | number | ## GLintptr | Name| Type| | -------- | -------- | | GLintptr | number | ## GLsizeiptr | Name| Type| | -------- | -------- | | GLsizeiptr | number | ## GLubyte | Name| Type| | -------- | -------- | | GLubyte | number | ## GLushort | Name| Type| | -------- | -------- | | GLushort | number | ## GLuint | Name| Type| | -------- | -------- | | GLuint | number | ## GLfloat | Name| Type| | -------- | -------- | | GLfloat | number | ## GLclampf | Name| Type| | -------- | -------- | | GLclampf | number | ## TexImageSource | Name| Type| | -------- | -------- | | TexImageSource | ImageData | ## Float32List | Name| Type| | -------- | -------- | | Float32List | array | ## Int32List | Name| Type| | -------- | -------- | | Int32List | array | ## WebGLPowerPreference | Name| Type| | -------- | -------- | | WebGLPowerPreference | string | ## webgl.WebGLContextAttributes WebGLContextAttributes | Name| Type| Mandatory| | -------- | -------- | -------- | | alpha | boolean | No| | depth | boolean | No| | stencil | boolean | No| | antialias | boolean | No| | premultipliedAlpha | boolean | No| | preserveDrawingBuffer | boolean | No| | powerPreference | WebGLPowerPreference | No| | failIfMajorPerformanceCaveat | boolean | No| | desynchronized | boolean | No| ## webgl.WebGLBuffer WebGLBuffer ## webgl.WebGLFrameBuffer WebGLFrameBuffer ## webgl.WebGLProgram WebGLProgram ## webgl.WebGLRenderbuffer WebGLRenderbuffer ## webgl.WebGLShader WebGLShader ## webgl.WebGLTexture WebGLTexture ## webgl.WebGLUniformLocation WebGLUniformLocation ## webgl.WebGLActiveInfo WebGLActiveInfo | Name| Type| Mandatory| | -------- | -------- | -------- | | size | [GLint](#glint) | Yes| | type | [GLenum](#glenum) | Yes| | name | string | Yes| ## webgl.WebGLShaderPrecisionFormat WebGLShaderPrecisionFormat | Name| Type| Mandatory| | -------- | -------- | -------- | | rangeMin | [GLint](#glint) | Yes| | rangeMax | [GLint](#glint) | Yes| | precision | [GLint](#glint) | Yes| ## webgl.WebGLRenderingContextBase WebGLRenderingContextBase ### Attributes | Name| Type| Mandatory| | -------- | -------- | -------- | | DEPTH_BUFFER_BIT | [GLenum](#glenum) | Yes| | STENCIL_BUFFER_BIT | [GLenum](#glenum) | Yes| | COLOR_BUFFER_BIT | [GLenum](#glenum) | Yes| | POINTS | [GLenum](#glenum) | Yes| | LINES | [GLenum](#glenum) | Yes| | LINE_LOOP | [GLenum](#glenum) | Yes| | LINE_STRIP | [GLenum](#glenum) | Yes| | TRIANGLES | [GLenum](#glenum) | Yes| | TRIANGLE_STRIP | [GLenum](#glenum) | Yes| | TRIANGLE_FAN | [GLenum](#glenum) | Yes| | ZERO | [GLenum](#glenum) | Yes| | ONE | [GLenum](#glenum) | Yes| | SRC_COLOR | [GLenum](#glenum) | Yes| | ONE_MINUS_SRC_COLOR | [GLenum](#glenum) | Yes| | SRC_ALPHA | [GLenum](#glenum) | Yes| | ONE_MINUS_SRC_ALPHA | [GLenum](#glenum) | Yes| | DST_ALPHA | [GLenum](#glenum) | Yes| | ONE_MINUS_DST_ALPHA | [GLenum](#glenum) | Yes| | DST_COLOR | [GLenum](#glenum) | Yes| | ONE_MINUS_DST_COLOR | [GLenum](#glenum) | Yes| | SRC_ALPHA_SATURATE | [GLenum](#glenum) | Yes| | FUNC_ADD | [GLenum](#glenum) | Yes| | BLEND_EQUATION | [GLenum](#glenum) | Yes| | BLEND_EQUATION_RGB | [GLenum](#glenum) | Yes| | BLEND_EQUATION_ALPHA | [GLenum](#glenum) | Yes| | FUNC_SUBTRACT | [GLenum](#glenum) | Yes| | FUNC_REVERSE_SUBTRACT | [GLenum](#glenum) | Yes| | BLEND_DST_RGB | [GLenum](#glenum) | Yes| | BLEND_SRC_RGB | [GLenum](#glenum) | Yes| | BLEND_DST_ALPHA | [GLenum](#glenum) | Yes| | BLEND_SRC_ALPHA | [GLenum](#glenum) | Yes| | CONSTANT_COLOR | [GLenum](#glenum) | Yes| | ONE_MINUS_CONSTANT_COLOR | [GLenum](#glenum) | Yes| | CONSTANT_ALPHA | [GLenum](#glenum) | Yes| | ONE_MINUS_CONSTANT_ALPHA | [GLenum](#glenum) | Yes| | BLEND_COLOR | [GLenum](#glenum) | Yes| | ARRAY_BUFFER | [GLenum](#glenum) | Yes| | ELEMENT_ARRAY_BUFFER | [GLenum](#glenum) | Yes| | ARRAY_BUFFER_BINDING | [GLenum](#glenum) | Yes| | ELEMENT_ARRAY_BUFFER_BINDING | [GLenum](#glenum) | Yes| | STREAM_DRAW | [GLenum](#glenum) | Yes| | STATIC_DRAW | [GLenum](#glenum) | Yes| | DYNAMIC_DRAW | [GLenum](#glenum) | Yes| | BUFFER_SIZE | [GLenum](#glenum) | Yes| | BUFFER_USAGE | [GLenum](#glenum) | Yes| | CURRENT_VERTEX_ATTRIB | [GLenum](#glenum) | Yes| | FRONT | [GLenum](#glenum) | Yes| | BACK | [GLenum](#glenum) | Yes| | FRONT_AND_BACK | [GLenum](#glenum) | Yes| | CULL_FACE | [GLenum](#glenum) | Yes| | BLEND | [GLenum](#glenum) | Yes| | DITHER | [GLenum](#glenum) | Yes| | STENCIL_TEST | [GLenum](#glenum) | Yes| | DEPTH_TEST | [GLenum](#glenum) | Yes| | SCISSOR_TEST | [GLenum](#glenum) | Yes| | POLYGON_OFFSET_FILL | [GLenum](#glenum) | Yes| | SAMPLE_ALPHA_TO_COVERAGE | [GLenum](#glenum) | Yes| | SAMPLE_COVERAGE | [GLenum](#glenum) | Yes| | NO_ERROR | [GLenum](#glenum) | Yes| | INVALID_ENUM | [GLenum](#glenum) | Yes| | INVALID_VALUE | [GLenum](#glenum) | Yes| | INVALID_OPERATION | [GLenum](#glenum) | Yes| | OUT_OF_MEMORY | [GLenum](#glenum) | Yes| | CW | [GLenum](#glenum) | Yes| | CCW | [GLenum](#glenum) | Yes| | ALIASED_POINT_SIZE_RANGE | [GLenum](#glenum) | Yes| | ALIASED_LINE_WIDTH_RANGE | [GLenum](#glenum) | Yes| | CULL_FACE_MODE | [GLenum](#glenum) | Yes| | FRONT_FACE | [GLenum](#glenum) | Yes| | DEPTH_RANGE | [GLenum](#glenum) | Yes| | DEPTH_WRITEMASK | [GLenum](#glenum) | Yes| | DEPTH_CLEAR_VALUE | [GLenum](#glenum) | Yes| | DEPTH_FUNC | [GLenum](#glenum) | Yes| | STENCIL_CLEAR_VALUE | [GLenum](#glenum) | Yes| | STENCIL_FUNC | [GLenum](#glenum) | Yes| | STENCIL_FAIL | [GLenum](#glenum) | Yes| | STENCIL_PASS_DEPTH_FAIL | [GLenum](#glenum) | Yes| | STENCIL_PASS_DEPTH_PASS | [GLenum](#glenum) | Yes| | STENCIL_REF | [GLenum](#glenum) | Yes| | STENCIL_VALUE_MASK | [GLenum](#glenum) | Yes| | STENCIL_WRITEMASK | [GLenum](#glenum) | Yes| | STENCIL_BACK_FUNC | [GLenum](#glenum) | Yes| | STENCIL_BACK_FAIL | [GLenum](#glenum) | Yes| | STENCIL_BACK_PASS_DEPTH_FAIL | [GLenum](#glenum) | Yes| | STENCIL_BACK_PASS_DEPTH_PASS | [GLenum](#glenum) | Yes| | STENCIL_BACK_REF | [GLenum](#glenum) | Yes| | STENCIL_BACK_VALUE_MASK | [GLenum](#glenum) | Yes| | STENCIL_BACK_WRITEMASK | [GLenum](#glenum) | Yes| | VIEWPORT | [GLenum](#glenum) | Yes| | SCISSOR_BOX | [GLenum](#glenum) | Yes| | COLOR_CLEAR_VALUE | [GLenum](#glenum) | Yes| | COLOR_WRITEMASK | [GLenum](#glenum) | Yes| | UNPACK_ALIGNMENT | [GLenum](#glenum) | Yes| | PACK_ALIGNMENT | [GLenum](#glenum) | Yes| | MAX_TEXTURE_SIZE | [GLenum](#glenum) | Yes| | MAX_VIEWPORT_DIMS | [GLenum](#glenum) | Yes| | SUBPIXEL_BITS | [GLenum](#glenum) | Yes| | RED_BITS | [GLenum](#glenum) | Yes| | GREEN_BITS | [GLenum](#glenum) | Yes| | BLUE_BITS | [GLenum](#glenum) | Yes| | ALPHA_BITS | [GLenum](#glenum) | Yes| | DEPTH_BITS | [GLenum](#glenum) | Yes| | STENCIL_BITS | [GLenum](#glenum) | Yes| | POLYGON_OFFSET_UNITS | [GLenum](#glenum) | Yes| | POLYGON_OFFSET_FACTOR | [GLenum](#glenum) | Yes| | TEXTURE_BINDING_2D | [GLenum](#glenum) | Yes| | SAMPLE_BUFFERS | [GLenum](#glenum) | Yes| | SAMPLES | [GLenum](#glenum) | Yes| | SAMPLE_COVERAGE_VALUE | [GLenum](#glenum) | Yes| | SAMPLE_COVERAGE_INVERT | [GLenum](#glenum) | Yes| | COMPRESSED_TEXTURE_FORMATS | [GLenum](#glenum) | Yes| | DONT_CARE | [GLenum](#glenum) | Yes| | FASTEST | [GLenum](#glenum) | Yes| | NICEST | [GLenum](#glenum) | Yes| | GENERATE_MIPMAP_HINT | [GLenum](#glenum) | Yes| | BYTE | [GLenum](#glenum) | Yes| | UNSIGNED_BYTE | [GLenum](#glenum) | Yes| | SHORT | [GLenum](#glenum) | Yes| | UNSIGNED_SHORT | [GLenum](#glenum) | Yes| | INT | [GLenum](#glenum) | Yes| | UNSIGNED_INT | [GLenum](#glenum) | Yes| | FLOAT | [GLenum](#glenum) | Yes| | DEPTH_COMPONENT | [GLenum](#glenum) | Yes| | ALPHA | [GLenum](#glenum) | Yes| | RGB | [GLenum](#glenum) | Yes| | RGBA | [GLenum](#glenum) | Yes| | LUMINANCE | [GLenum](#glenum) | Yes| | LUMINANCE_ALPHA | [GLenum](#glenum) | Yes| | UNSIGNED_SHORT_4_4_4_4 | [GLenum](#glenum) | Yes| | UNSIGNED_SHORT_5_5_5_1 | [GLenum](#glenum) | Yes| | UNSIGNED_SHORT_5_6_5 | [GLenum](#glenum) | Yes| | FRAGMENT_SHADER | [GLenum](#glenum) | Yes| | VERTEX_SHADER | [GLenum](#glenum) | Yes| | MAX_VERTEX_ATTRIBS | [GLenum](#glenum) | Yes| | MAX_VERTEX_UNIFORM_VECTORS | [GLenum](#glenum) | Yes| | MAX_VARYING_VECTORS | [GLenum](#glenum) | Yes| | MAX_COMBINED_TEXTURE_IMAGE_UNITS | [GLenum](#glenum) | Yes| | MAX_VERTEX_TEXTURE_IMAGE_UNITS | [GLenum](#glenum) | Yes| | MAX_TEXTURE_IMAGE_UNITS | [GLenum](#glenum) | Yes| | MAX_FRAGMENT_UNIFORM_VECTORS | [GLenum](#glenum) | Yes| | SHADER_TYPE | [GLenum](#glenum) | Yes| | DELETE_STATUS | [GLenum](#glenum) | Yes| | LINK_STATUS | [GLenum](#glenum) | Yes| | VALIDATE_STATUS | [GLenum](#glenum) | Yes| | ATTACHED_SHADERS | [GLenum](#glenum) | Yes| | ACTIVE_UNIFORMS | [GLenum](#glenum) | Yes| | ACTIVE_ATTRIBUTES | [GLenum](#glenum) | Yes| | SHADING_LANGUAGE_VERSION | [GLenum](#glenum) | Yes| | CURRENT_PROGRAM | [GLenum](#glenum) | Yes| | NEVER | [GLenum](#glenum) | Yes| | LESS | [GLenum](#glenum) | Yes| | EQUAL | [GLenum](#glenum) | Yes| | LEQUAL | [GLenum](#glenum) | Yes| | GREATER | [GLenum](#glenum) | Yes| | NOTEQUAL | [GLenum](#glenum) | Yes| | GEQUAL | [GLenum](#glenum) | Yes| | ALWAYS | [GLenum](#glenum) | Yes| | KEEP | [GLenum](#glenum) | Yes| | REPLACE | [GLenum](#glenum) | Yes| | INCR | [GLenum](#glenum) | Yes| | DECR | [GLenum](#glenum) | Yes| | INVERT | [GLenum](#glenum) | Yes| | INCR_WRAP | [GLenum](#glenum) | Yes| | DECR_WRAP | [GLenum](#glenum) | Yes| | VENDOR | [GLenum](#glenum) | Yes| | RENDERER | [GLenum](#glenum) | Yes| | VERSION | [GLenum](#glenum) | Yes| | NEAREST | [GLenum](#glenum) | Yes| | LINEAR | [GLenum](#glenum) | Yes| | NEAREST_MIPMAP_NEAREST | [GLenum](#glenum) | Yes| | LINEAR_MIPMAP_NEAREST | [GLenum](#glenum) | Yes| | NEAREST_MIPMAP_LINEAR | [GLenum](#glenum) | Yes| | LINEAR_MIPMAP_LINEAR | [GLenum](#glenum) | Yes| | TEXTURE_MAG_FILTER | [GLenum](#glenum) | Yes| | TEXTURE_MIN_FILTER | [GLenum](#glenum) | Yes| | TEXTURE_WRAP_S | [GLenum](#glenum) | Yes| | TEXTURE_WRAP_T | [GLenum](#glenum) | Yes| | TEXTURE_2D | [GLenum](#glenum) | Yes| | TEXTURE | [GLenum](#glenum) | Yes| | TEXTURE_CUBE_MAP | [GLenum](#glenum) | Yes| | TEXTURE_BINDING_CUBE_MAP | [GLenum](#glenum) | Yes| | TEXTURE_CUBE_MAP_POSITIVE_X | [GLenum](#glenum) | Yes| | TEXTURE_CUBE_MAP_NEGATIVE_X | [GLenum](#glenum) | Yes| | TEXTURE_CUBE_MAP_POSITIVE_Y | [GLenum](#glenum) | Yes| | TEXTURE_CUBE_MAP_NEGATIVE_Y | [GLenum](#glenum) | Yes| | TEXTURE_CUBE_MAP_POSITIVE_Z | [GLenum](#glenum) | Yes| | TEXTURE_CUBE_MAP_NEGATIVE_Z | [GLenum](#glenum) | Yes| | TEXTURE0 | [GLenum](#glenum) | Yes| | TEXTURE1 | [GLenum](#glenum) | Yes| | TEXTURE2 | [GLenum](#glenum) | Yes| | TEXTURE3 | [GLenum](#glenum) | Yes| | TEXTURE4 | [GLenum](#glenum) | Yes| | TEXTURE5 | [GLenum](#glenum) | Yes| | TEXTURE6 | [GLenum](#glenum) | Yes| | TEXTURE7 | [GLenum](#glenum) | Yes| | TEXTURE8 | [GLenum](#glenum) | Yes| | TEXTURE9 | [GLenum](#glenum) | Yes| | TEXTURE10 | [GLenum](#glenum) | Yes| | TEXTURE11 | [GLenum](#glenum) | Yes| | TEXTURE12 | [GLenum](#glenum) | Yes| | TEXTURE13 | [GLenum](#glenum) | Yes| | TEXTURE14 | [GLenum](#glenum) | Yes| | TEXTURE15 | [GLenum](#glenum) | Yes| | TEXTURE16 | [GLenum](#glenum) | Yes| | TEXTURE17 | [GLenum](#glenum) | Yes| | TEXTURE18 | [GLenum](#glenum) | Yes| | TEXTURE19 | [GLenum](#glenum) | Yes| | TEXTURE20 | [GLenum](#glenum) | Yes| | TEXTURE21 | [GLenum](#glenum) | Yes| | TEXTURE22 | [GLenum](#glenum) | Yes| | TEXTURE23 | [GLenum](#glenum) | Yes| | TEXTURE24 | [GLenum](#glenum) | Yes| | TEXTURE25 | [GLenum](#glenum) | Yes| | TEXTURE26 | [GLenum](#glenum) | Yes| | TEXTURE27 | [GLenum](#glenum) | Yes| | TEXTURE28 | [GLenum](#glenum) | Yes| | TEXTURE29 | [GLenum](#glenum) | Yes| | TEXTURE30 | [GLenum](#glenum) | Yes| | TEXTURE31 | [GLenum](#glenum) | Yes| | ACTIVE_TEXTURE | [GLenum](#glenum) | Yes| | REPEAT | [GLenum](#glenum) | Yes| | CLAMP_TO_EDGE | [GLenum](#glenum) | Yes| | MIRRORED_REPEAT | [GLenum](#glenum) | Yes| | FLOAT_VEC2 | [GLenum](#glenum) | Yes| | FLOAT_VEC3 | [GLenum](#glenum) | Yes| | FLOAT_VEC4 | [GLenum](#glenum) | Yes| | INT_VEC2 | [GLenum](#glenum) | Yes| | INT_VEC3 | [GLenum](#glenum) | Yes| | INT_VEC4 | [GLenum](#glenum) | Yes| | BOOL | [GLenum](#glenum) | Yes| | BOOL_VEC2 | [GLenum](#glenum) | Yes| | BOOL_VEC3 | [GLenum](#glenum) | Yes| | BOOL_VEC4 | [GLenum](#glenum) | Yes| | FLOAT_MAT2 | [GLenum](#glenum) | Yes| | FLOAT_MAT3 | [GLenum](#glenum) | Yes| | FLOAT_MAT4 | [GLenum](#glenum) | Yes| | SAMPLER_2D | [GLenum](#glenum) | Yes| | SAMPLER_CUBE | [GLenum](#glenum) | Yes| | VERTEX_ATTRIB_ARRAY_ENABLED | [GLenum](#glenum) | Yes| | VERTEX_ATTRIB_ARRAY_SIZE | [GLenum](#glenum) | Yes| | VERTEX_ATTRIB_ARRAY_STRIDE | [GLenum](#glenum) | Yes| | VERTEX_ATTRIB_ARRAY_TYPE | [GLenum](#glenum) | Yes| | VERTEX_ATTRIB_ARRAY_NORMALIZED | [GLenum](#glenum) | Yes| | VERTEX_ATTRIB_ARRAY_POINTER | [GLenum](#glenum) | Yes| | VERTEX_ATTRIB_ARRAY_BUFFER_BINDING | [GLenum](#glenum) | Yes| | IMPLEMENTATION_COLOR_READ_TYPE | [GLenum](#glenum) | Yes| | IMPLEMENTATION_COLOR_READ_FORMAT | [GLenum](#glenum) | Yes| | COMPILE_STATUS | [GLenum](#glenum) | Yes| | LOW_FLOAT | [GLenum](#glenum) | Yes| | MEDIUM_FLOAT | [GLenum](#glenum) | Yes| | HIGH_FLOAT | [GLenum](#glenum) | Yes| | LOW_INT | [GLenum](#glenum) | Yes| | MEDIUM_INT | [GLenum](#glenum) | Yes| | HIGH_INT | [GLenum](#glenum) | Yes| | FRAMEBUFFER | [GLenum](#glenum) | Yes| | RENDERBUFFER | [GLenum](#glenum) | Yes| | RGBA4 | [GLenum](#glenum) | Yes| | RGB5_A1 | [GLenum](#glenum) | Yes| | RGB565 | [GLenum](#glenum) | Yes| | DEPTH_COMPONENT16 | [GLenum](#glenum) | Yes| | STENCIL_INDEX8 | [GLenum](#glenum) | Yes| | DEPTH_STENCIL | [GLenum](#glenum) | Yes| | RENDERBUFFER_WIDTH | [GLenum](#glenum) | Yes| | RENDERBUFFER_HEIGHT | [GLenum](#glenum) | Yes| | RENDERBUFFER_INTERNAL_FORMAT | [GLenum](#glenum) | Yes| | RENDERBUFFER_RED_SIZE | [GLenum](#glenum) | Yes| | RENDERBUFFER_GREEN_SIZE | [GLenum](#glenum) | Yes| | RENDERBUFFER_BLUE_SIZE | [GLenum](#glenum) | Yes| | RENDERBUFFER_ALPHA_SIZE | [GLenum](#glenum) | Yes| | RENDERBUFFER_DEPTH_SIZE | [GLenum](#glenum) | Yes| | RENDERBUFFER_STENCIL_SIZE | [GLenum](#glenum) | Yes| | FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE | [GLenum](#glenum) | Yes| | FRAMEBUFFER_ATTACHMENT_OBJECT_NAME | [GLenum](#glenum) | Yes| | FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL | [GLenum](#glenum) | Yes| | FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE | [GLenum](#glenum) | Yes| | COLOR_ATTACHMENT0 | [GLenum](#glenum) | Yes| | DEPTH_ATTACHMENT | [GLenum](#glenum) | Yes| | STENCIL_ATTACHMENT | [GLenum](#glenum) | Yes| | DEPTH_STENCIL_ATTACHMENT | [GLenum](#glenum) | Yes| | NONE | [GLenum](#glenum) | Yes| | FRAMEBUFFER_COMPLETE | [GLenum](#glenum) | Yes| | FRAMEBUFFER_INCOMPLETE_ATTACHMENT | [GLenum](#glenum) | Yes| | FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT | [GLenum](#glenum) | Yes| | FRAMEBUFFER_INCOMPLETE_DIMENSIONS | [GLenum](#glenum) | Yes| | FRAMEBUFFER_UNSUPPORTED | [GLenum](#glenum) | Yes| | FRAMEBUFFER_BINDING | [GLenum](#glenum) | Yes| | RENDERBUFFER_BINDING | [GLenum](#glenum) | Yes| | MAX_RENDERBUFFER_SIZE | [GLenum](#glenum) | Yes| | INVALID_FRAMEBUFFER_OPERATION | [GLenum](#glenum) | Yes| | UNPACK_FLIP_Y_WEBGL | [GLenum](#glenum) | Yes| | UNPACK_PREMULTIPLY_ALPHA_WEBGL | [GLenum](#glenum) | Yes| | CONTEXT_LOST_WEBGL | [GLenum](#glenum) | Yes| | UNPACK_COLORSPACE_CONVERSION_WEBGL | [GLenum](#glenum) | Yes| | BROWSER_DEFAULT_WEBGL | [GLenum](#glenum) | Yes| | canvas | HTMLCanvasElement \| OffscreenCanvas | Yes| | drawingBufferWidth | [GLsizei](#glsizei) | Yes| | drawingBufferHeight | [GLsizei](#glsizei) | Yes| ### Methods | Method| Return Value Type| | -------- | -------- | | getContextAttributes() | WebGLContextAttributes \| null | | isContextLost() | boolean | | getSupportedExtensions() | string[] \| null | | getExtension(name: string) | any | | activeTexture(texture: GLenum) | void | | attachShader(program: WebGLProgram, shader: WebGLShader) | void | | bindAttribLocation(program: WebGLProgram, index: GLuint, name: string) | void | | bindBuffer(target: GLenum, buffer: WebGLBuffer \| null) | void | | bindFramebuffer(target: GLenum, framebuffer: WebGLFramebuffer \| null) | void | | bindRenderbuffer(target: GLenum, renderbuffer: WebGLRenderbuffer \| null) | void | | bindTexture(target: GLenum, texture: WebGLTexture \| null) | void | | blendColor(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) | void | | blendEquation(mode: GLenum) | void | | blendEquationSeparate(modeRGB: GLenum, modeAlpha: GLenum) | void | | blendFunc(sfactor: GLenum, dfactor: GLenum) | void | | blendFuncSeparate(srcRGB: GLenum, dstRGB: GLenum, srcAlpha: GLenum, dstAlpha: GLenum) | void | | checkFramebufferStatus(target: GLenum) | GLenum | | clear(mask: GLbitfield) | void | | clearColor(red: GLclampf, green: GLclampf, blue: GLclampf, alpha: GLclampf) | void | | clearDepth(depth: GLclampf) | void | | clearStencil(s: GLint) | void | | colorMask(red: GLboolean, green: GLboolean, blue: GLboolean, alpha: GLboolean) | void | | compileShader(shader: WebGLShader) | void | | copyTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, x: GLint, y: GLint, width: GLsizei, height: GLsizei, border: GLint) | void | | copyTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | | createBuffer() | WebGLBuffer \| null | | createFramebuffer() | WebGLFramebuffer \| null | | createProgram() | WebGLProgram \| null | | createRenderbuffer() | WebGLRenderbuffer \| null | | createShader(type: GLenum) | WebGLShader \| null | | createTexture() | WebGLTexture \| nullvoid | | cullFace(mode: GLenum) | void | | deleteBuffer(buffer: WebGLBuffer \| null) | void | | deleteFramebuffer(framebuffer: WebGLFramebuffer \| null) | void | | deleteProgram(program: WebGLProgram \| null) | void | | deleteRenderbuffer(renderbuffer: WebGLRenderbuffer \| null) | void | | deleteShader(shader: WebGLShader \| null) | void | | deleteTexture(texture: WebGLTexture \| null) | void | | depthFunc(func: GLenum) | void | | depthMask(flag: GLboolean) | void | | depthRange(zNear: GLclampf, zFar: GLclampf) | void | | detachShader(program: WebGLProgram, shader: WebGLShader) | void | | disable(cap: GLenum) | void | | disableVertexAttribArray(index: GLuint) | void | | drawArrays(mode: GLenum, first: GLint, count: GLsizei) | void | | drawElements(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr) | void | | enable(cap: GLenum) | void | | enableVertexAttribArray(index: GLuint) | void | | finish() | void | | flush() | void | | framebufferRenderbuffer(target: GLenum, attachment: GLenum, renderbuffertarget: GLenum, renderbuffer: WebGLRenderbuffer \| null) | void | | framebufferTexture2D(target: GLenum, attachment: GLenum, textarget: GLenum, texture: WebGLTexture \| null, level: GLint) | void | | frontFace(mode: GLenum) | void | | generateMipmap(target: GLenum) | void | | getActiveAttrib(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | | getActiveUniform(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | | getAttachedShaders(program: WebGLProgram) | WebGLShader[] \| null | | getAttribLocation(program: WebGLProgram, name: string) | GLint | | getBufferParameter(target: GLenum, pname: GLenum) | any | | getParameter(pname: GLenum) | any | | getError() | GLenum | | getFramebufferAttachmentParameter(target: GLenum, attachment: GLenum, pname: GLenum) | any | | getProgramParameter(program: WebGLProgram, pname: GLenum) | any | | getProgramInfoLog(program: WebGLProgram) | string \| null | | getRenderbufferParameter(target: GLenum, pname: GLenum) | any | | getShaderParameter(shader: WebGLShader, pname: GLenum) | any | | getShaderPrecisionFormat(shadertype: GLenum, precisiontype: GLenum) | WebGLShaderPrecisionFormat \| null | | getShaderInfoLog(shader: WebGLShader) | string \| null | | getShaderSource(shader: WebGLShader) | string \| null | | getTexParameter(target: GLenum, pname: GLenum) | any | | getUniform(program: WebGLProgram, location: WebGLUniformLocation) | any | | getUniformLocation(program: WebGLProgram, name: string) | WebGLUniformLocation \| null | | getVertexAttrib(index: GLuint, pname: GLenum) | any | | getVertexAttribOffset(index: GLuint, pname: GLenum) | GLintptr | | hint(target: GLenum, mode: GLenum) | void | | isBuffer(buffer: WebGLBuffer \| null) | GLboolean | | isEnabled(cap: GLenum) | GLboolean | | isFramebuffer(framebuffer: WebGLFramebuffer \| null) | GLboolean | | isProgram(program: WebGLProgram \| null) | GLboolean | | isRenderbuffer(renderbuffer: WebGLRenderbuffer \| null) | GLboolean | | isShader(shader: WebGLShader \| null) | GLboolean | | isTexture(texture: WebGLTexture \| null) | GLboolean | | lineWidth(width: GLfloat) | void | | linkProgram(program: WebGLProgram) | void | | pixelStorei(pname: GLenum, param: GLint \| GLboolean) | void | | polygonOffset(factor: GLfloat, units: GLfloat) | void | | renderbufferStorage(target: GLenum, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | | sampleCoverage(value: GLclampf, invert: GLboolean) | void | | scissor(x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | | shaderSource(shader: WebGLShader, source: string) | void | | stencilFunc(func: GLenum, ref: GLint, mask: GLuint) | void | | stencilFuncSeparate(face: GLenum, func: GLenum, ref: GLint, mask: GLuint) | void | | stencilMask(mask: GLuint) | void | | stencilMaskSeparate(face: GLenum, mask: GLuint) | void | | stencilOp(fail: GLenum, zfail: GLenum, zpass: GLenum) | void | | stencilOpSeparate(face: GLenum, fail: GLenum, zfail: GLenum, zpass: GLenum) | void | | texParameterf(target: GLenum, pname: GLenum, param: GLfloat) | void | | texParameteri(target: GLenum, pname: GLenum, param: GLint) | void | | uniform1f(location: WebGLUniformLocation \| null, x: GLfloat) | void | | uniform2f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat) | void | | uniform3f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat, z: GLfloat) | void | | uniform4f(location: WebGLUniformLocation \| null, x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat) | void | | uniform1i(location: WebGLUniformLocation \| null, x: GLint) | void | | uniform2i(location: WebGLUniformLocation \| null, x: GLint, y: GLint) | void | | uniform3i(location: WebGLUniformLocation \| null, x: GLint, y: GLint, z: GLint) | void | | uniform4i(location: WebGLUniformLocation \| null, x: GLint, y: GLint, z: GLint, w: GLint) | void | | useProgram(program: WebGLProgram \| null) | void | | validateProgram(program: WebGLProgram) | void | | vertexAttrib1f(index: GLuint, x: GLfloat) | void | | vertexAttrib2f(index: GLuint, x: GLfloat, y: GLfloat) | void | | vertexAttrib3f(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat) | void | | vertexAttrib4f(index: GLuint, x: GLfloat, y: GLfloat, z: GLfloat, w: GLfloat) | void | | vertexAttrib1fv(index: GLuint, values: Float32List) | void | | vertexAttrib2fv(index: GLuint, values: Float32List) | void | | vertexAttrib3fv(index: GLuint, values: Float32List) | void | | vertexAttrib4fv(index: GLuint, values: Float32List) | void | | vertexAttribPointer(index: GLuint, size: GLint, type: GLenum, normalized: GLboolean, stride: GLsizei, offset: GLintptr) | void | | viewport(x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | ## webgl.WebGLRenderingContextOverloads WebGLRenderingContextOverloads | Method| Return Value Type| | -------- | -------- | | bufferData(target: GLenum, size: GLsizeiptr, usage: GLenum) | void | | bufferData(target: GLenum, data: BufferSource \| null, usage: GLenum) | void | | bufferSubData(target: GLenum, offset: GLintptr, data: BufferSource) | void | | compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, data: ArrayBufferView) | void | | compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, data: ArrayBufferView) | void | | readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | | texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | | texImage2D(target: GLenum, level: GLint, internalformat: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | | texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | | texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | | uniform1fv(location: WebGLUniformLocation \| null, v: Float32List) | void | | uniform2fv(location: WebGLUniformLocation \| null, v: Float32List) | void | | uniform3fv(location: WebGLUniformLocation \| null, v: Float32List) | void | | uniform4fv(location: WebGLUniformLocation \| null, v: Float32List) | void | | uniform1iv(location: WebGLUniformLocation \| null, v: Int32List) | void | | uniform2iv(location: WebGLUniformLocation \| null, v: Int32List) | void | | uniform3iv(location: WebGLUniformLocation \| null, v: Int32List) | void | | uniform4iv(location: WebGLUniformLocation \| null, v: Int32List) | void | | uniformMatrix2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | | uniformMatrix3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void | | uniformMatrix4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, value: Float32List) | void |