The WebGLRenderingContext
interface provides the OpenGL ES 2.0 rendering context for the drawing surface of an HTML <canvas>
element.
To get an object of this interface, call getContext()
on a <canvas>
element, supplying "webgl" as the argument:
var canvas = document.getElementById('myCanvas'); var gl = canvas.getContext('webgl');
Once you have the WebGL rendering context for a canvas, you can render within it.
The WebGL tutorial has more information, examples, and resources on how to get started with WebGL.
See the WebGL constants page.
The following properties and methods provide general information and functionality to deal with the WebGL context:
WebGLRenderingContext.canvas
HTMLCanvasElement
. Might be null
if it is not associated with a <canvas>
element.WebGLRenderingContext.commit()
Pushes frames back to the original HTMLCanvasElement
, if the context is not directly fixed to a specific canvas.
WebGLRenderingContext.drawingBufferWidth
WebGLRenderingContext.drawingBufferHeight
WebGLRenderingContext.getContextAttributes()
WebGLContextAttributes
object that contains the actual context parameters. Might return null
, if the context is lost.WebGLRenderingContext.isContextLost()
true
if the context is lost, otherwise returns false
.WebGLRenderingContext.scissor()
WebGLRenderingContext.viewport()
WebGLRenderingContext.activeTexture()
WebGLRenderingContext.blendColor()
WebGLRenderingContext.blendEquation()
WebGLRenderingContext.blendEquationSeparate()
WebGLRenderingContext.blendFunc()
WebGLRenderingContext.blendFuncSeparate()
WebGLRenderingContext.clearColor()
WebGLRenderingContext.clearDepth()
WebGLRenderingContext.clearStencil()
WebGLRenderingContext.colorMask()
WebGLFramebuffer
.WebGLRenderingContext.cullFace()
WebGLRenderingContext.depthFunc()
WebGLRenderingContext.depthMask()
WebGLRenderingContext.depthRange()
WebGLRenderingContext.disable()
WebGLRenderingContext.enable()
WebGLRenderingContext.frontFace()
WebGLRenderingContext.getParameter()
WebGLRenderingContext.getError()
WebGLRenderingContext.hint()
WebGLRenderingContext.isEnabled()
WebGLRenderingContext.lineWidth()
WebGLRenderingContext.pixelStorei()
WebGLRenderingContext.polygonOffset()
WebGLRenderingContext.sampleCoverage()
WebGLRenderingContext.stencilFunc()
WebGLRenderingContext.stencilFuncSeparate()
WebGLRenderingContext.stencilMask()
WebGLRenderingContext.stencilMaskSeparate()
WebGLRenderingContext.stencilOp()
WebGLRenderingContext.stencilOpSeparate()
WebGLRenderingContext.bindBuffer()
WebGLBuffer
object to a given target.WebGLRenderingContext.bufferData()
WebGLRenderingContext.bufferSubData()
WebGLRenderingContext.createBuffer()
WebGLBuffer
object.WebGLRenderingContext.deleteBuffer()
WebGLBuffer
object.WebGLRenderingContext.getBufferParameter()
WebGLRenderingContext.isBuffer()
WebGLRenderingContext.bindFramebuffer()
WebGLFrameBuffer
object to a given target.WebGLRenderingContext.checkFramebufferStatus()
WebGLRenderingContext.createFramebuffer()
WebGLFrameBuffer
object.WebGLRenderingContext.deleteFramebuffer()
WebGLFrameBuffer
object.WebGLRenderingContext.framebufferRenderbuffer()
WebGLRenderingBuffer
object to a WebGLFrameBuffer
object.WebGLRenderingContext.framebufferTexture2D()
WebGLFrameBuffer
object.WebGLRenderingContext.getFramebufferAttachmentParameter()
WebGLRenderingContext.isFramebuffer()
WebGLFrameBuffer
object is valid.WebGLRenderingContext.readPixels()
WebGLFrameBuffer
.WebGLRenderingContext.bindRenderbuffer()
WebGLRenderBuffer
object to a given target.WebGLRenderingContext.createRenderbuffer()
WebGLRenderBuffer
object.WebGLRenderingContext.deleteRenderbuffer()
WebGLRenderBuffer
object.WebGLRenderingContext.getRenderbufferParameter()
WebGLRenderingContext.isRenderbuffer()
WebGLRenderingBuffer
is valid.WebGLRenderingContext.renderbufferStorage()
WebGLRenderingContext.bindTexture()
WebGLTexture
object to a given target.WebGLRenderingContext.compressedTexImage2D()
WebGLRenderingContext.compressedTexSubImage2D()
WebGLRenderingContext.copyTexImage2D()
WebGLRenderingContext.copyTexSubImage2D()
WebGLRenderingContext.createTexture()
WebGLTexture
object.WebGLRenderingContext.deleteTexture()
WebGLTexture
object.WebGLRenderingContext.generateMipmap()
WebGLTexture
object.WebGLRenderingContext.getTexParameter()
WebGLRenderingContext.isTexture()
WebGLTexture
is valid.WebGLRenderingContext.texImage2D()
WebGLRenderingContext.texSubImage2D()
WebGLTexture
.WebGLRenderingContext.texParameterf()
WebGLRenderingContext.texParameteri()
WebGLRenderingContext.attachShader()
WebGLShader
to a WebGLProgram
.WebGLRenderingContext.bindAttribLocation()
WebGLRenderingContext.compileShader()
WebGLShader
.WebGLRenderingContext.createProgram()
WebGLProgram
.WebGLRenderingContext.createShader()
WebGLShader
.WebGLRenderingContext.deleteProgram()
WebGLProgram
.WebGLRenderingContext.deleteShader()
WebGLShader
.WebGLRenderingContext.detachShader()
WebGLShader
.WebGLRenderingContext.getAttachedShaders()
WebGLShader
objects attached to a WebGLProgram
.WebGLRenderingContext.getProgramParameter()
WebGLRenderingContext.getProgramInfoLog()
WebGLProgram
object.WebGLRenderingContext.getShaderParameter()
WebGLRenderingContext.getShaderPrecisionFormat()
WebGLShaderPrecisionFormat
object describing the precision for the numeric format of the shader.WebGLRenderingContext.getShaderInfoLog()
WebGLShader
object.WebGLRenderingContext.getShaderSource()
WebGLShader
as a string.WebGLRenderingContext.isProgram()
WebGLProgram
is valid.WebGLRenderingContext.isShader()
WebGLShader
is valid.WebGLRenderingContext.linkProgram()
WebGLProgram
object.WebGLRenderingContext.shaderSource()
WebGLShader
.WebGLRenderingContext.useProgram()
WebGLProgram
as part the current rendering state.WebGLRenderingContext.validateProgram()
WebGLProgram
.WebGLRenderingContext.disableVertexAttribArray()
WebGLRenderingContext.enableVertexAttribArray()
WebGLRenderingContext.getActiveAttrib()
WebGLRenderingContext.getActiveUniform()
WebGLRenderingContext.getAttribLocation()
WebGLRenderingContext.getUniform()
WebGLRenderingContext.getUniformLocation()
WebGLRenderingContext.getVertexAttrib()
WebGLRenderingContext.getVertexAttribOffset()
WebGLRenderingContext.uniform[1234][fi][v]()
WebGLRenderingContext.uniformMatrix[234]fv()
WebGLRenderingContext.vertexAttrib[1234]f[v]()
WebGLRenderingContext.vertexAttribPointer()
WebGLRenderingContext.clear()
WebGLRenderingContext.drawArrays()
WebGLRenderingContext.drawElements()
WebGLRenderingContext.finish()
WebGLRenderingContext.flush()
These methods manage WebGL extensions:
WebGLRenderingContext.getSupportedExtensions()
Array
of DOMString
elements with all the supported WebGL extensions.WebGLRenderingContext.getExtension()
This example demonstrates how to detect a WebGL rendering context and reports the result to the user.
<p>[ Here would go the result of WebGL feature detection ]</p> <button>Press here to detect WebGLRenderingContext</button>
body { text-align : center; } button { display : block; font-size : inherit; margin : auto; padding : 0.6em; }
// Run everything inside window load event handler, to make sure // DOM is fully loaded and styled before trying to manipulate it. window.addEventListener("load", function() { var paragraph = document.querySelector("p"), button = document.querySelector("button"); // Adding click event handler to button. button.addEventListener("click", detectWebGLContext, false); function detectWebGLContext () { // Create canvas element. The canvas is not added to the // document itself, so it is never displayed in the // browser window. var canvas = document.createElement("canvas"); // Get WebGLRenderingContext from canvas element. var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); // Report the result. if (gl && gl instanceof WebGLRenderingContext) { paragraph.innerHTML = "Congratulations! Your browser supports WebGL."; } else { paragraph.innerHTML = "Failed to get WebGL context. " + "Your browser or device may not support WebGL."; } } }, false);
The source code of this example is also available on GitHub.
With scissor()
and clear()
we can demonstrate how the WebGL drawing buffer is affected by the size of the canvas.
The size of the first canvas is set to the styled Element
size, determined by CSS. This is done by assigning the width
and height
properties of the canvas to the values of the clientWidth
and clientHeight
properties, respectively.
In contrast, no such assignment is done for the second canvas. The internal width
and height
properties of the canvas remain at default values, which are different than the actual size of the canvas Element
in the browser window.
The effect is clearly visible when using scissor()
and clear()
to draw a square in the center of the canvas, by specifying its position and size in pixels. In the first canvas, we get the desired result. In the second, the square has the wrong shape, size, and position.
<p>Compare the two canvases.</p> <canvas>Your browser does not seem to support HTML5 canvas.</canvas> <canvas>Your browser does not seem to support HTML5 canvas.</canvas>
body { text-align : center; } canvas { display : inline-block; width : 120px; height : 80px; margin : auto; padding : 0; border : none; background-color : black; }
window.addEventListener("load", function() { "use strict" var firstCanvas = document.getElementsByTagName("canvas")[0], secondCanvas = document.getElementsByTagName("canvas")[1]; firstCanvas.width = firstCanvas.clientWidth; firstCanvas.height = firstCanvas.clientHeight; [firstCanvas, secondCanvas].forEach(function(canvas) { var gl = canvas.getContext("webgl") || canvas.getContext("experimental-webgl"); if (!gl) { document.querySelector("p").innerHTML = "Failed to get WebGL context. " + "Your browser or device may not support WebGL."; return; } gl.viewport(0, 0, gl.drawingBufferWidth, gl.drawingBufferHeight); gl.enable(gl.SCISSOR_TEST); gl.scissor(30, 10, 60, 60); gl.clearColor(1.0, 1.0, 0.0, 1.0); gl.clear(gl.COLOR_BUFFER_BIT); }); }, false);
The source code of this example is also available on GitHub.
Specification | Status | Comment |
---|---|---|
WebGL 1.0 The definition of 'WebGLRenderingContext' in that specification. | Recommendation | Initial definition |
Feature | Chrome | Edge | Firefox | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 9 | 121 | 4 | 111 | 12 | 5.1 |
Available in workers | No | No | 442 | No | No | No |
activeTexture |
9 | 12 | 4 | 11 | 12 | 5.1 |
attachShader |
9 | 12 | 4 | 11 | 12 | 5.1 |
bindAttribLocation |
9 | 12 | 4 | 11 | 12 | 5.1 |
bindBuffer |
9 | 12 | 4 | 11 | 12 | 5.1 |
bindFramebuffer |
9 | 12 | 4 | 11 | 12 | 5.1 |
bindRenderbuffer |
9 | 12 | 4 | 11 | 12 | 5.1 |
bindTexture |
9 | 12 | 4 | 11 | 12 | 5.1 |
blendColor |
9 | 12 | 4 | 11 | 12 | 5.1 |
blendEquation |
9 | 12 | 4 | 11 | 12 | 5.1 |
blendEquationSeparate |
9 | 12 | 4 | 11 | 12 | 5.1 |
blendFunc |
9 | 12 | 4 | 11 | 12 | 5.1 |
blendFuncSeparate |
9 | 12 | 4 | 11 | 12 | 5.1 |
bufferData |
9 | 12 | 4 | 11 | 12 | 5.1 |
bufferSubData |
9 | 12 | 4 | 11 | 12 | 5.1 |
canvas |
9 | 12 | 4 | 11 | 12 | 5.1 |
checkFramebufferStatus |
9 | 12 | 4 | 11 | 12 | 5.1 |
clear |
9 | 12 | 4 | 11 | 12 | 5.1 |
clearColor |
9 | 12 | 4 | 11 | 12 | 5.1 |
clearDepth |
9 | 12 | 4 | 11 | 12 | 5.1 |
clearStencil |
9 | 12 | 4 | 11 | 12 | 5.1 |
colorMask |
9 | 12 | 4 | 11 | 12 | 5.1 |
commit |
No | No | 442 | No | No | No |
compileShader |
9 | 12 | 4 | 11 | 12 | 5.1 |
compressedTexImage2D |
9 | 12 | 4 | 11 | 12 | 5.1 |
compressedTexSubImage2D |
9 | 12 | 4 | 11 | 12 | 5.1 |
copyTexImage2D |
9 | 12 | 4 | 11 | 12 | 5.1 |
copyTexSubImage2D |
9 | 12 | 4 | 11 | 12 | 5.1 |
createBuffer |
9 | 12 | 4 | 11 | 12 | 5.1 |
createFramebuffer |
9 | 12 | 4 | 11 | 12 | 5.1 |
createProgram |
9 | 12 | 4 | 11 | 12 | 5.1 |
createRenderbuffer |
9 | 12 | 4 | 11 | 12 | 5.1 |
createShader |
9 | 12 | 4 | 11 | 12 | 5.1 |
createTexture |
9 | 12 | 4 | 11 | 12 | 5.1 |
cullFace |
9 | 12 | 4 | 11 | 12 | 5.1 |
deleteBuffer |
9 | 12 | 4 | 11 | 12 | 5.1 |
deleteFramebuffer |
9 | 12 | 4 | 11 | 12 | 5.1 |
deleteProgram |
9 | 12 | 4 | 11 | 12 | 5.1 |
deleteRenderbuffer |
9 | 12 | 4 | 11 | 12 | 5.1 |
deleteShader |
9 | 12 | 4 | 11 | 12 | 5.1 |
deleteTexture |
9 | 12 | 4 | 11 | 12 | 5.1 |
depthFunc |
9 | 12 | 4 | 11 | 12 | 5.1 |
depthMask |
9 | 12 | 4 | 11 | 12 | 5.1 |
depthRange |
9 | 12 | 4 | 11 | 12 | 5.1 |
detachShader |
9 | 12 | 4 | 11 | 12 | 5.1 |
disable |
9 | 12 | 4 | 11 | 12 | 5.1 |
disableVertexAttribArray |
9 | 12 | 4 | 11 | 12 | 5.1 |
drawArrays |
9 | 12 | 4 | 11 | 12 | 5.1 |
drawElements |
9 | 12 | 4 | 11 | 12 | 5.1 |
drawingBufferHeight |
9 | 12 | 4 | 11 | 12 | 5.1 |
drawingBufferWidth |
9 | 12 | 4 | 11 | 12 | 5.1 |
enable |
9 | 12 | 4 | 11 | 12 | 5.1 |
enableVertexAttribArray |
9 | 12 | 4 | 11 | 12 | 5.1 |
finish |
9 | 12 | 4 | 11 | 12 | 5.1 |
flush |
9 | 12 | 4 | 11 | 12 | 5.1 |
framebufferRenderbuffer |
9 | 12 | 4 | 11 | 12 | 5.1 |
framebufferTexture2D |
9 | 12 | 4 | 11 | 12 | 5.1 |
frontFace |
9 | 12 | 4 | 11 | 12 | 5.1 |
generateMipmap |
9 | 12 | 4 | 11 | 12 | 5.1 |
getActiveAttrib |
9 | 12 | 4 | 11 | 12 | 5.1 |
getActiveUniform |
9 | 12 | 4 | 11 | 12 | 5.1 |
getAttachedShaders |
9 | 12 | 4 | 11 | 12 | 5.1 |
getAttribLocation |
9 | 12 | 4 | 11 | 12 | 5.1 |
getBufferParameter |
9 | 12 | 4 | 11 | 12 | 5.1 |
getContextAttributes |
9 | 12 | 4 | 11 | 12 | 5.1 |
getError |
9 | 12 | 4 | 11 | 12 | 5.1 |
getExtension |
9 | 12 | 4 | 11 | 12 | 5.1 |
getFramebufferAttachmentParameter |
9 | 12 | 4 | 11 | 12 | 5.1 |
getParameter |
9 | 12 | 4 | 11 | 12 | 5.1 |
getProgramInfoLog |
9 | 12 | 4 | 11 | 12 | 5.1 |
getProgramParameter |
9 | 12 | 4 | 11 | 12 | 5.1 |
getRenderbufferParameter |
9 | 12 | 4 | 11 | 12 | 5.1 |
getShaderInfoLog |
9 | 12 | 4 | 11 | 12 | 5.1 |
getShaderParameter |
9 | 12 | 4 | 11 | 12 | 5.1 |
getShaderPrecisionFormat |
9 | 12 | 4 | 11 | 12 | 5.1 |
getShaderSource |
9 | 12 | 4 | 11 | 12 | 5.1 |
getSupportedExtensions |
9 | 12 | 4 | 11 | 12 | 5.1 |
getTexParameter |
9 | 12 | 4 | 11 | 12 | 5.1 |
getUniform |
9 | 12 | 4 | 11 | 12 | 5.1 |
getUniformLocation |
9 | 12 | 4 | 11 | 12 | 5.1 |
getVertexAttrib |
9 | 12 | 4 | 11 | 12 | 5.1 |
getVertexAttribOffset |
9 | 12 | 4 | 11 | 12 | 5.1 |
hint |
9 | 12 | 4 | 11 | 12 | 5.1 |
isBuffer |
9 | 12 | 4 | 11 | 12 | 5.1 |
isContextLost |
9 | 12 | 4 | 11 | 12 | 5.1 |
isEnabled |
9 | 12 | 4 | 11 | 12 | 5.1 |
isFramebuffer |
9 | 12 | 4 | 11 | 12 | 5.1 |
isProgram |
9 | 12 | 4 | 11 | 12 | 5.1 |
isRenderbuffer |
9 | 12 | 4 | 11 | 12 | 5.1 |
isShader |
9 | 12 | 4 | 11 | 12 | 5.1 |
isTexture |
9 | 12 | 4 | 11 | 12 | 5.1 |
lineWidth |
No | No | No | No | No | No |
linkProgram |
9 | 12 | 4 | 11 | 12 | 5.1 |
pixelStorei |
9 | 12 | 4 | 11 | 12 | 5.1 |
polygonOffset |
9 | 12 | 4 | 11 | 12 | 5.1 |
readPixels |
9 | 12 | 4 | 11 | 12 | 5.1 |
renderbufferStorage |
9 | 12 | 4 | 11 | 12 | 5.1 |
sampleCoverage |
9 | 12 | 4 | 11 | 12 | 5.1 |
scissor |
9 | 12 | 4 | 11 | 12 | 5.1 |
shaderSource |
9 | 12 | 4 | 11 | 12 | 5.1 |
stencilFunc |
9 | 12 | 4 | 11 | 12 | 5.1 |
stencilFuncSeparate |
9 | 12 | 4 | 11 | 12 | 5.1 |
stencilMask |
9 | 12 | 4 | 11 | 12 | 5.1 |
stencilMaskSeparate |
9 | 12 | 4 | 11 | 12 | 5.1 |
stencilOp |
9 | 12 | 4 | 11 | 12 | 5.1 |
stencilOpSeparate |
9 | 12 | 4 | 11 | 12 | 5.1 |
texImage2D |
9 | 12 | 4 | 11 | 12 | 5.1 |
texParameterf |
9 | 12 | 4 | 11 | 12 | 5.1 |
texParameteri |
9 | 12 | 4 | 11 | 12 | 5.1 |
texSubImage2D |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform1f |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform1fv |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform1i |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform1iv |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform2f |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform2fv |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform2i |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform2iv |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform3f |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform3fv |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform3i |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform3iv |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform4f |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform4fv |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform4i |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniform4iv |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniformMatrix2fv |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniformMatrix3fv |
9 | 12 | 4 | 11 | 12 | 5.1 |
uniformMatrix4fv |
9 | 12 | 4 | 11 | 12 | 5.1 |
useProgram |
9 | 12 | 4 | 11 | 12 | 5.1 |
validateProgram |
9 | 12 | 4 | 11 | 12 | 5.1 |
vertexAttrib1f |
9 | 12 | 4 | 11 | 12 | 5.1 |
vertexAttrib1fv |
9 | 12 | 4 | 11 | 12 | 5.1 |
vertexAttrib2f |
9 | 12 | 4 | 11 | 12 | 5.1 |
vertexAttrib2fv |
9 | 12 | 4 | 11 | 12 | 5.1 |
vertexAttrib3f |
9 | 12 | 4 | 11 | 12 | 5.1 |
vertexAttrib3fv |
9 | 12 | 4 | 11 | 12 | 5.1 |
vertexAttrib4f |
9 | 12 | 4 | 11 | 12 | 5.1 |
vertexAttrib4fv |
9 | 12 | 4 | 11 | 12 | 5.1 |
vertexAttribPointer |
9 | 12 | 4 | 11 | 12 | 5.1 |
viewport |
9 | 12 | 4 | 11 | 12 | 5.1 |
Feature | Android webview | Chrome for Android | Edge mobile | Firefox for Android | IE mobile | Opera Android | iOS Safari |
---|---|---|---|---|---|---|---|
Basic support | Yes | 25 | Yes1 | Yes | 111 | 12 | 8.1 |
Available in workers | No | No | No | No | No | No | No |
activeTexture |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
attachShader |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
bindAttribLocation |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
bindBuffer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
bindFramebuffer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
bindRenderbuffer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
bindTexture |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
blendColor |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
blendEquation |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
blendEquationSeparate |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
blendFunc |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
blendFuncSeparate |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
bufferData |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
bufferSubData |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
canvas |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
checkFramebufferStatus |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
clear |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
clearColor |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
clearDepth |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
clearStencil |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
colorMask |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
commit |
No | No | No | No | No | No | No |
compileShader |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
compressedTexImage2D |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
compressedTexSubImage2D |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
copyTexImage2D |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
copyTexSubImage2D |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
createBuffer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
createFramebuffer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
createProgram |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
createRenderbuffer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
createShader |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
createTexture |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
cullFace |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
deleteBuffer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
deleteFramebuffer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
deleteProgram |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
deleteRenderbuffer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
deleteShader |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
deleteTexture |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
depthFunc |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
depthMask |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
depthRange |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
detachShader |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
disable |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
disableVertexAttribArray |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
drawArrays |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
drawElements |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
drawingBufferHeight |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
drawingBufferWidth |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
enable |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
enableVertexAttribArray |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
finish |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
flush |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
framebufferRenderbuffer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
framebufferTexture2D |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
frontFace |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
generateMipmap |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getActiveAttrib |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getActiveUniform |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getAttachedShaders |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getAttribLocation |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getBufferParameter |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getContextAttributes |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getError |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getExtension |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getFramebufferAttachmentParameter |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getParameter |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getProgramInfoLog |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getProgramParameter |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getRenderbufferParameter |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getShaderInfoLog |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getShaderParameter |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getShaderPrecisionFormat |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getShaderSource |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getSupportedExtensions |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getTexParameter |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getUniform |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getUniformLocation |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getVertexAttrib |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
getVertexAttribOffset |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
hint |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
isBuffer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
isContextLost |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
isEnabled |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
isFramebuffer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
isProgram |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
isRenderbuffer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
isShader |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
isTexture |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
lineWidth |
No | No | No | No | No | No | No |
linkProgram |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
pixelStorei |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
polygonOffset |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
readPixels |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
renderbufferStorage |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
sampleCoverage |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
scissor |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
shaderSource |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
stencilFunc |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
stencilFuncSeparate |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
stencilMask |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
stencilMaskSeparate |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
stencilOp |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
stencilOpSeparate |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
texImage2D |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
texParameterf |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
texParameteri |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
texSubImage2D |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform1f |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform1fv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform1i |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform1iv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform2f |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform2fv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform2i |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform2iv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform3f |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform3fv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform3i |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform3iv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform4f |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform4fv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform4i |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniform4iv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniformMatrix2fv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniformMatrix3fv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
uniformMatrix4fv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
useProgram |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
validateProgram |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
vertexAttrib1f |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
vertexAttrib1fv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
vertexAttrib2f |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
vertexAttrib2fv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
vertexAttrib3f |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
vertexAttrib3fv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
vertexAttrib4f |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
vertexAttrib4fv |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
vertexAttribPointer |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
viewport |
Yes | 25 | Yes | Yes | 11 | 12 | 8.1 |
1. To access the WebGL context, use experimental-webgl
rather than the standard webgl
identifier.
2. From version 44: this feature is behind the gfx.offscreencanvas.enabled
preference (needs to be set to true
). To change preferences in Firefox, visit about:config.
© 2005–2018 Mozilla Developer Network and individual contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext