W3cubDocs

/Web APIs

WebGL: 2D and 3D graphics for the web

WebGL (Web Graphics Library) is a JavaScript API for rendering high-performance interactive 3D and 2D graphics within any compatible web browser without the use of plug-ins. WebGL does so by introducing an API that closely conforms to OpenGL ES 2.0 that can be used in HTML <canvas> elements. This conformance makes it possible for the API to take advantage of hardware graphics acceleration provided by the user's device.

Support for WebGL is present in all modern browsers (see the compatibility tables below); however, the user's device must also have hardware that supports these features.

The WebGL 2 API introduces support for much of the OpenGL ES 3.0 feature set; it's provided through the WebGL2RenderingContext interface.

The <canvas> element is also used by the Canvas API to do 2D graphics on web pages.

Reference

Standard interfaces

Extensions

Events

Constants and types

WebGL 2

WebGL 2 is a major update to WebGL which is provided through the WebGL2RenderingContext interface. It is based on OpenGL ES 3.0 and new features include:

See also the blog post "WebGL 2 lands in Firefox" and webglsamples.org/WebGL2Samples for a few demos.

Guides and tutorials

Below, you'll find an assortment of guides to help you learn WebGL concepts and tutorials that offer step-by-step lessons and examples.

Guides

Data in WebGL

A guide to variables, buffers, and other types of data used when writing WebGL code.

WebGL best practices

Tips and suggestions to help you improve the quality, performance, and reliability of your WebGL content.

Using extensions

A guide to using WebGL extensions.

Tutorials

WebGL tutorial

A beginner's guide to WebGL core concepts. A good place to start if you don't have previous WebGL experience.

Examples

A basic 2D WebGL animation example

This example demonstrates the simple animation of a one-color shape. Topics examined are adapting to aspect ratio differences, a function to build shader programs from sets of multiple shaders, and the basics of drawing in WebGL.

WebGL by example

A series of live samples with short explanations that showcase WebGL concepts and capabilities. The examples are sorted according to topic and level of difficulty, covering the WebGL rendering context, shader programming, textures, geometry, user interaction, and more.

Advanced tutorials

WebGL model view projection

A detailed explanation of the three core matrices that are typically used to represent a 3D object view: the model, view and projection matrices.

Matrix math for the web

A useful guide to how 3D transform matrices work, and can be used on the web — both for WebGL calculations and in CSS transforms.

Resources

Libraries

  • three.js is an open-source, fully featured 3D WebGL library.
  • Babylon.js is a powerful, simple, and open game and 3D rendering engine packed into a friendly JavaScript framework.
  • Pixi.js is a fast, open-source 2D WebGL renderer.
  • Phaser is a fast, free and fun open source framework for Canvas and WebGL powered browser games.
  • PlayCanvas is an open-source game engine.
  • glMatrix is a JavaScript matrix and vector library for high-performance WebGL apps.
  • twgl is a library for making webgl less verbose.
  • RedGL is an open-source 3D WebGL library.
  • vtk.js is a JavaScript library for scientific visualization in your browser.
  • webgl-lint will help find errors in your WebGL code and provide useful info

Specifications

Browser compatibility

Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
WebGL_API 56 79 51 No 43 15 58 58 51 43 15 7.0
activeTexture 56 79 51 No 43 15 58 58 51 43 15 7.0
attachShader 56 79 51 No 43 15 58 58 51 43 15 7.0
beginQuery 56 79 51 No 43 15 58 58 51 43 15 7.0
beginTransformFeedback 56 79 51 No 43 15 58 58 51 43 15 7.0
bindAttribLocation 56 79 51 No 43 15 58 58 51 43 15 7.0
bindBuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
bindBufferBase 56 79 51 No 43 15 58 58 51 43 15 7.0
bindBufferRange 56 79 51 No 43 15 58 58 51 43 15 7.0
bindFramebuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
bindRenderbuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
bindSampler 56 79 51 No 43 15 58 58 51 43 15 7.0
bindTexture 56 79 51 No 43 15 58 58 51 43 15 7.0
bindTransformFeedback 56 79 51 No 43 15 58 58 51 43 15 7.0
bindVertexArray 56 79 51 No 43 15 58 58 51 43 15 7.0
blendColor 56 79 51 No 43 15 58 58 51 43 15 7.0
blendEquation 56 79 51 No 43 15 58 58 51 43 15 7.0
blendEquationSeparate 56 79 51 No 43 15 58 58 51 43 15 7.0
blendFunc 56 79 51 No 43 15 58 58 51 43 15 7.0
blendFuncSeparate 56 79 51 No 43 15 58 58 51 43 15 7.0
blitFramebuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
bufferData 56 79 51 No 43 15 58 58 51 43 15 7.0
bufferSubData 56 79 51 No 43 15 58 58 51 43 15 7.0
canvas 56 79 51 No 43 15 58 58 51 43 15 7.0
checkFramebufferStatus 56 79 51 No 43 15 58 58 51 43 15 7.0
clear 56 79 51 No 43 15 58 58 51 43 15 7.0
clearBufferfi 56 79 51 No 43 15 58 58 51 43 15 7.0
clearBufferfv 56 79 51 No 43 15 58 58 51 43 15 7.0
clearBufferiv 56 79 51 No 43 15 58 58 51 43 15 7.0
clearBufferuiv 56 79 51 No 43 15 58 58 51 43 15 7.0
clearColor 56 79 51 No 43 15 58 58 51 43 15 7.0
clearDepth 56 79 51 No 43 15 58 58 51 43 15 7.0
clearStencil 56 79 51 No 43 15 58 58 51 43 15 7.0
clientWaitSync 56 79 51 No 43 15 58 58 51 43 15 7.0
colorMask 56 79 51 No 43 15 58 58 51 43 15 7.0
compileShader 56 79 51 No 43 15 58 58 51 43 15 7.0
compressedTexImage2D 56 79 51 No 43 15 58 58 51 43 15 7.0
compressedTexImage3D 56 79 51 No 43 15 58 58 51 43 15 7.0
compressedTexSubImage2D 56 79 51 No 43 15 58 58 51 43 15 7.0
compressedTexSubImage3D 56 79 51 No 43 15 58 58 51 43 15 7.0
copyBufferSubData 56 79 51 No 43 15 58 58 51 43 15 7.0
copyTexImage2D 56 79 51 No 43 15 58 58 51 43 15 7.0
copyTexSubImage2D 56 79 51 No 43 15 58 58 51 43 15 7.0
copyTexSubImage3D 56 79 51 No 43 15 58 58 51 43 15 7.0
createBuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
createFramebuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
createProgram 56 79 51 No 43 15 58 58 51 43 15 7.0
createQuery 56 79 51 No 43 15 58 58 51 43 15 7.0
createRenderbuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
createSampler 56 79 51 No 43 15 58 58 51 43 15 7.0
createShader 56 79 51 No 43 15 58 58 51 43 15 7.0
createTexture 56 79 51 No 43 15 58 58 51 43 15 7.0
createTransformFeedback 56 79 51 No 43 15 58 58 51 43 15 7.0
createVertexArray 56 79 51 No 43 15 58 58 51 43 15 7.0
cullFace 56 79 51 No 43 15 58 58 51 43 15 7.0
deleteBuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
deleteFramebuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
deleteProgram 56 79 51 No 43 15 58 58 51 43 15 7.0
deleteQuery 56 79 51 No 43 15 58 58 51 43 15 7.0
deleteRenderbuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
deleteSampler 56 79 51 No 43 15 58 58 51 43 15 7.0
deleteShader 56 79 51 No 43 15 58 58 51 43 15 7.0
deleteSync 56 79 51 No 43 15 58 58 51 43 15 7.0
deleteTexture 56 79 51 No 43 15 58 58 51 43 15 7.0
deleteTransformFeedback 56 79 51 No 43 15 58 58 51 43 15 7.0
deleteVertexArray 56 79 51 No 43 15 58 58 51 43 15 7.0
depthFunc 56 79 51 No 43 15 58 58 51 43 15 7.0
depthMask 56 79 51 No 43 15 58 58 51 43 15 7.0
depthRange 56 79 51 No 43 15 58 58 51 43 15 7.0
detachShader 56 79 51 No 43 15 58 58 51 43 15 7.0
disable 56 79 51 No 43 15 58 58 51 43 15 7.0
disableVertexAttribArray 56 79 51 No 43 15 58 58 51 43 15 7.0
drawArrays 56 79 51 No 43 15 58 58 51 43 15 7.0
drawArraysInstanced 56 79 51 No 43 15 58 58 51 43 15 7.0
drawBuffers 56 79 51 No 43 15 58 58 51 43 15 7.0
drawElements 56 79 51 No 43 15 58 58 51 43 15 7.0
drawElementsInstanced 56 79 51 No 43 15 58 58 51 43 15 7.0
drawRangeElements 56 79 51 No 43 15 58 58 51 43 15 7.0
drawingBufferColorSpace 104 104 No No 90 16.4 104 104 No 71 16.4 20.0
drawingBufferHeight 56 79 51 No 43 15 58 58 51 43 15 7.0
drawingBufferWidth 56 79 51 No 43 15 58 58 51 43 15 7.0
enable 56 79 51 No 43 15 58 58 51 43 15 7.0
enableVertexAttribArray 56 79 51 No 43 15 58 58 51 43 15 7.0
endQuery 56 79 51 No 43 15 58 58 51 43 15 7.0
endTransformFeedback 56 79 51 No 43 15 58 58 51 43 15 7.0
fenceSync 56 79 51 No 43 15 58 58 51 43 15 7.0
finish 56 79 51 No 43 15 58 58 51 43 15 7.0
flush 56 79 51 No 43 15 58 58 51 43 15 7.0
framebufferRenderbuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
framebufferTexture2D 56 79 51 No 43 15 58 58 51 43 15 7.0
framebufferTextureLayer 56 79 51 No 43 15 58 58 51 43 15 7.0
frontFace 56 79 51 No 43 15 58 58 51 43 15 7.0
generateMipmap 56 79 51 No 43 15 58 58 51 43 15 7.0
getActiveAttrib 56 79 51 No 43 15 58 58 51 43 15 7.0
getActiveUniform 56 79 51 No 43 15 58 58 51 43 15 7.0
getActiveUniformBlockName 56 79 51 No 43 15 58 58 51 43 15 7.0
getActiveUniformBlockParameter 56 79 51 No 43 15 58 58 51 43 15 7.0
getActiveUniforms 56 79 51 No 43 15 58 58 51 43 15 7.0
getAttachedShaders 56 79 51 No 43 15 58 58 51 43 15 7.0
getAttribLocation 56 79 51 No 43 15 58 58 51 43 15 7.0
getBufferParameter 56 79 51 No 43 15 58 58 51 43 15 7.0
getBufferSubData 56 79 51 No 43 15 58 58 51 43 15 7.0
getContextAttributes 56 79 51 No 43 15 58 58 51 43 15 7.0
getError 56 79 51 No 43 15 58 58 51 43 15 7.0
getExtension 56 79 51 No 43 15 58 58 51 43 15 7.0
getFragDataLocation 56 79 51 No 43 15 58 58 51 43 15 7.0
getFramebufferAttachmentParameter 56 79 51 No 43 15 58 58 51 43 15 7.0
getIndexedParameter 56 79 51 No 43 15 58 58 51 43 15 7.0
getInternalformatParameter 56 79 51 No 43 15 58 58 51 43 15 7.0
getParameter 56 79 51 No 43 15 58 58 51 43 15 7.0
getProgramInfoLog 56 79 51 No 43 15 58 58 51 43 15 7.0
getProgramParameter 56 79 51 No 43 15 58 58 51 43 15 7.0
getQuery 56 79 51 No 43 15 58 58 51 43 15 7.0
getQueryParameter 56 79 51 No 43 15 58 58 51 43 15 7.0
getRenderbufferParameter 56 79 51 No 43 15 58 58 51 43 15 7.0
getSamplerParameter 56 79 51 No 43 15 58 58 51 43 15 7.0
getShaderInfoLog 56 79 51 No 43 15 58 58 51 43 15 7.0
getShaderParameter 56 79 51 No 43 15 58 58 51 43 15 7.0
getShaderPrecisionFormat 56 79 51 No 43 15 58 58 51 43 15 7.0
getShaderSource 56 79 51 No 43 15 58 58 51 43 15 7.0
getSupportedExtensions 56 79 51 No 43 15 58 58 51 43 15 7.0
getSyncParameter 56 79 51 No 43 15 58 58 51 43 15 7.0
getTexParameter 56 79 51 No 43 15 58 58 51 43 15 7.0
getTransformFeedbackVarying 56 79 51 No 43 15 58 58 51 43 15 7.0
getUniform 56 79 51 No 43 15 58 58 51 43 15 7.0
getUniformBlockIndex 56 79 51 No 43 15 58 58 51 43 15 7.0
getUniformIndices 56 79 51 No 43 15 58 58 51 43 15 7.0
getUniformLocation 56 79 51 No 43 15 58 58 51 43 15 7.0
getVertexAttrib 56 79 51 No 43 15 58 58 51 43 15 7.0
getVertexAttribOffset 56 79 51 No 43 15 58 58 51 43 15 7.0
hint 56 79 51 No 43 15 58 58 51 43 15 7.0
invalidateFramebuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
invalidateSubFramebuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
isBuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
isContextLost 56 79 51 No 43 15 58 58 51 43 15 7.0
isEnabled 56 79 51 No 43 15 58 58 51 43 15 7.0
isFramebuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
isProgram 56 79 51 No 43 15 58 58 51 43 15 7.0
isQuery 56 79 51 No 43 15 58 58 51 43 15 7.0
isRenderbuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
isSampler 56 79 51 No 43 15 58 58 51 43 15 7.0
isShader 56 79 51 No 43 15 58 58 51 43 15 7.0
isSync 56 79 51 No 43 15 58 58 51 43 15 7.0
isTexture 56 79 51 No 43 15 58 58 51 43 15 7.0
isTransformFeedback 56 79 51 No 43 15 58 58 51 43 15 7.0
isVertexArray 56 79 51 No 43 15 58 58 51 43 15 7.0
lineWidth 56 79 51 No 43 15 58 58 51 43 15 7.0
linkProgram 56 79 51 No 43 15 58 58 51 43 15 7.0
makeXRCompatible 79 79 No No 66 No No 79 No 57 No 11.2
pauseTransformFeedback 56 79 51 No 43 15 58 58 51 43 15 7.0
pixelStorei 56 79 51 No 43 15 58 58 51 43 15 7.0
polygonOffset 56 79 51 No 43 15 58 58 51 43 15 7.0
readBuffer 56 79 51 No 43 15 58 58 51 43 15 7.0
readPixels 56 79 51 No 43 15 58 58 51 43 15 7.0
renderbufferStorage 56 79 51 No 43 15 58 58 51 43 15 7.0
renderbufferStorageMultisample 56 79 51 No 43 15 58 58 51 43 15 7.0
resumeTransformFeedback 56 79 51 No 43 15 58 58 51 43 15 7.0
sampleCoverage 56 79 51 No 43 15 58 58 51 43 15 7.0
samplerParameterf 56 79 51 No 43 15 58 58 51 43 15 7.0
samplerParameteri 56 79 51 No 43 15 58 58 51 43 15 7.0
scissor 56 79 51 No 43 15 58 58 51 43 15 7.0
shaderSource 56 79 51 No 43 15 58 58 51 43 15 7.0
stencilFunc 56 79 51 No 43 15 58 58 51 43 15 7.0
stencilFuncSeparate 56 79 51 No 43 15 58 58 51 43 15 7.0
stencilMask 56 79 51 No 43 15 58 58 51 43 15 7.0
stencilMaskSeparate 56 79 51 No 43 15 58 58 51 43 15 7.0
stencilOp 56 79 51 No 43 15 58 58 51 43 15 7.0
stencilOpSeparate 56 79 51 No 43 15 58 58 51 43 15 7.0
texImage2D 56 79 51 No 43 15 58 58 51 43 15 7.0
texImage3D 56 79 51 No 43 15 58 58 51 43 15 7.0
texParameterf 56 79 51 No 43 15 58 58 51 43 15 7.0
texParameteri 56 79 51 No 43 15 58 58 51 43 15 7.0
texStorage2D 56 79 51 No 43 15 58 58 51 43 15 7.0
texStorage3D 56 79 51 No 43 15 58 58 51 43 15 7.0
texSubImage2D 56 79 51 No 43 15 58 58 51 43 15 7.0
texSubImage3D 56 79 51 No 43 15 58 58 51 43 15 7.0
transformFeedbackVaryings 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform1f 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform1fv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform1i 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform1iv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform1ui 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform1uiv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform2f 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform2fv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform2i 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform2iv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform2ui 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform2uiv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform3f 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform3fv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform3i 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform3iv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform3ui 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform3uiv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform4f 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform4fv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform4i 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform4iv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform4ui 56 79 51 No 43 15 58 58 51 43 15 7.0
uniform4uiv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniformBlockBinding 56 79 51 No 43 15 58 58 51 43 15 7.0
uniformMatrix2fv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniformMatrix2x3fv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniformMatrix2x4fv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniformMatrix3fv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniformMatrix3x2fv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniformMatrix3x4fv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniformMatrix4fv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniformMatrix4x2fv 56 79 51 No 43 15 58 58 51 43 15 7.0
uniformMatrix4x3fv 56 79 51 No 43 15 58 58 51 43 15 7.0
unpackColorSpace 104 104 No No 90 No 104 104 No 71 No 20.0
useProgram 56 79 51 No 43 15 58 58 51 43 15 7.0
validateProgram 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttrib1f 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttrib1fv 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttrib2f 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttrib2fv 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttrib3f 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttrib3fv 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttrib4f 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttrib4fv 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttribDivisor 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttribI4i 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttribI4iv 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttribI4ui 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttribI4uiv 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttribIPointer 56 79 51 No 43 15 58 58 51 43 15 7.0
vertexAttribPointer 56 79 51 No 43 15 58 58 51 43 15 7.0
viewport 56 79 51 No 43 15 58 58 51 43 15 7.0
waitSync 56 79 51 No 43 15 58 58 51 43 15 7.0
Desktop Mobile
Chrome Edge Firefox Internet Explorer Opera Safari WebView Android Chrome Android Firefox for Android Opera Android Safari on IOS Samsung Internet
WebGL_API 9
12To access the WebGL context, use experimental-webgl rather than the standard webgl identifier.
4
11To access the WebGL context, use experimental-webgl rather than the standard webgl identifier.
12 5.1 4.4.3 25 4 12 8 1.5
activeTexture 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
attachShader 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
bindAttribLocation 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
bindBuffer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
bindFramebuffer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
bindRenderbuffer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
bindTexture 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
blendColor 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
blendEquation 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
blendEquationSeparate 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
blendFunc 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
blendFuncSeparate 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
bufferData 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
bufferSubData 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
canvas 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
checkFramebufferStatus 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
clear 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
clearColor 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
clearDepth 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
clearStencil 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
colorMask 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
compileShader 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
compressedTexImage2D 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
compressedTexSubImage2D 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
copyTexImage2D 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
copyTexSubImage2D 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
createBuffer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
createFramebuffer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
createProgram 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
createRenderbuffer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
createShader 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
createTexture 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
cullFace 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
deleteBuffer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
deleteFramebuffer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
deleteProgram 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
deleteRenderbuffer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
deleteShader 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
deleteTexture 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
depthFunc 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
depthMask 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
depthRange 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
detachShader 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
disable 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
disableVertexAttribArray 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
drawArrays 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
drawElements 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
drawingBufferColorSpace 104 104 No No 90 16.4 104 104 No 71 16.4 20.0
drawingBufferHeight 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
drawingBufferWidth 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
enable 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
enableVertexAttribArray 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
finish 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
flush 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
framebufferRenderbuffer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
framebufferTexture2D 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
frontFace 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
generateMipmap 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getActiveAttrib 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getActiveUniform 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getAttachedShaders 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getAttribLocation 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getBufferParameter 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getContextAttributes 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getError 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getExtension 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getFramebufferAttachmentParameter 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getParameter 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getProgramInfoLog 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getProgramParameter 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getRenderbufferParameter 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getShaderInfoLog 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getShaderParameter 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getShaderPrecisionFormat 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getShaderSource 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getSupportedExtensions 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getTexParameter 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getUniform 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getUniformLocation 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getVertexAttrib 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
getVertexAttribOffset 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
hint 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
isBuffer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
isContextLost 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
isEnabled 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
isFramebuffer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
isProgram 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
isRenderbuffer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
isShader 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
isTexture 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
lineWidth 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
linkProgram 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
makeXRCompatible 79 79 No No No No No 79 No No No 11.2
pixelStorei 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
polygonOffset 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
readPixels 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
renderbufferStorage 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
sampleCoverage 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
scissor 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
shaderSource 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
stencilFunc 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
stencilFuncSeparate 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
stencilMask 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
stencilMaskSeparate 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
stencilOp 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
stencilOpSeparate 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
texImage2D 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
texParameterf 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
texParameteri 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
texSubImage2D 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform1f 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform1fv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform1i 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform1iv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform2f 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform2fv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform2i 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform2iv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform3f 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform3fv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform3i 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform3iv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform4f 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform4fv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform4i 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniform4iv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniformMatrix2fv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniformMatrix3fv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
uniformMatrix4fv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
unpackColorSpace 104 104 No No 90 No 104 104 No 71 No 20.0
useProgram 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
validateProgram 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
vertexAttrib1f 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
vertexAttrib1fv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
vertexAttrib2f 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
vertexAttrib2fv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
vertexAttrib3f 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
vertexAttrib3fv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
vertexAttrib4f 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
vertexAttrib4fv 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
vertexAttribPointer 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
viewport 9 12 4 11 12 5.1 4.4.3 25 4 12 8 1.5
worker_support No No 105 No No No No No 105 No No No

api.WebGLRenderingContext

BCD tables only load in the browser

api.WebGL2RenderingContext

BCD tables only load in the browser

Compatibility notes

In addition to the browser, the GPU itself also needs to support the feature. So, for example, S3 Texture Compression (S3TC) is only available on Tegra-based tablets. Most browsers make the WebGL context available through the webgl context name, but older ones need experimental-webgl as well. In addition, the upcoming WebGL 2 is fully backwards-compatible and will have the context name webgl2.

Gecko notes

WebGL debugging and testing

Firefox provides two preferences available which let you control the capabilities of WebGL for testing purposes:

webgl.min_capability_mode

A Boolean property that, when true, enables a minimum capability mode. When in this mode, WebGL is configured to only support the bare minimum feature set and capabilities required by the WebGL specification. This lets you ensure that your WebGL code will work on any device or browser, regardless of their capabilities. This is false by default.

webgl.disable_extensions

A Boolean property that, when true, disables all WebGL extensions. This is false by default.

See also

© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API