WebGLRenderingContext class

The interface provides an interface to the OpenGL ES 2.0 graphics rendering context for the drawing surface of an HTML <canvas> element. To get an access to a WebGL context for 2D and/or 3D graphics rendering, 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. If you require a WebGL 2.0 context, see WebGL2RenderingContext; this supplies access to an implementation of OpenGL ES 3.0 graphics.

Implemented types
Available extensions
Annotations
  • @JS.new()
  • @staticInterop

Constructors

WebGLRenderingContext()
factory

Properties

canvas → dynamic

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

no setter
drawingBufferColorSpace ↔ PredefinedColorSpace

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getter/setter pair
drawingBufferHeight → int

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

no setter
drawingBufferWidth → int

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

no setter
hashCode → int
The hash code for this object.
no setterinherited
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
unpackColorSpace ↔ PredefinedColorSpace

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getter/setter pair

Methods

activeTexture(int texture) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

attachShader(WebGLProgram program, WebGLShader shader) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

bindAttribLocation(WebGLProgram program, int index, String name) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

bindBuffer(int target, WebGLBuffer? buffer) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

bindFramebuffer(int target, WebGLFramebuffer? framebuffer) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

bindRenderbuffer(int target, WebGLRenderbuffer? renderbuffer) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

bindTexture(int target, WebGLTexture? texture) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

blendColor(dynamic red, dynamic green, dynamic blue, dynamic alpha) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

blendEquation(int mode) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

blendEquationSeparate(int modeRGB, int modeAlpha) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

blendFunc(int sfactor, int dfactor) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

blendFuncSeparate(int srcRGB, int dstRGB, int srcAlpha, int dstAlpha) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

bufferData(int target, int size, int usage) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

bufferSubData(int target, int offset, dynamic data) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

checkFramebufferStatus(int target) → int

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

clear(int mask) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

clearColor(dynamic red, dynamic green, dynamic blue, dynamic alpha) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

clearDepth(dynamic depth) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

clearStencil(int s) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

colorMask(bool red, bool green, bool blue, bool alpha) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

compileShader(WebGLShader shader) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

compressedTexImage2D(int target, int level, int internalformat, int width, int height, int border, dynamic data) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

compressedTexSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, int format, dynamic data) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

copyTexImage2D(int target, int level, int internalformat, int x, int y, int width, int height, int border) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

copyTexSubImage2D(int target, int level, int xoffset, int yoffset, int x, int y, int width, int height) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

createBuffer() → WebGLBuffer?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

createFramebuffer() → WebGLFramebuffer?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

createProgram() → WebGLProgram?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

createRenderbuffer() → WebGLRenderbuffer?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

createShader(int type) → WebGLShader?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

createTexture() → WebGLTexture?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

cullFace(int mode) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

deleteBuffer(WebGLBuffer? buffer) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

deleteFramebuffer(WebGLFramebuffer? framebuffer) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

deleteProgram(WebGLProgram? program) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

deleteRenderbuffer(WebGLRenderbuffer? renderbuffer) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

deleteShader(WebGLShader? shader) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

deleteTexture(WebGLTexture? texture) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

depthFunc(int func) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

depthMask(bool flag) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

depthRange(dynamic zNear, dynamic zFar) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

detachShader(WebGLProgram program, WebGLShader shader) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

disable(int cap) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

disableVertexAttribArray(int index) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

drawArrays(int mode, int first, int count) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

drawElements(int mode, int count, int type, int offset) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

enable(int cap) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

enableVertexAttribArray(int index) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

finish() → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

flush() → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

framebufferRenderbuffer(int target, int attachment, int renderbuffertarget, WebGLRenderbuffer? renderbuffer) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

framebufferTexture2D(int target, int attachment, int textarget, WebGLTexture? texture, int level) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

frontFace(int mode) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

generateMipmap(int target) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getActiveAttrib(WebGLProgram program, int index) → WebGLActiveInfo?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getActiveUniform(WebGLProgram program, int index) → WebGLActiveInfo?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getAttachedShaders(WebGLProgram program) → Iterable<WebGLShader>

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getAttribLocation(WebGLProgram program, String name) → int

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getBufferParameter(int target, int pname) → dynamic

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getContextAttributes() → WebGLContextAttributes?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getError() → int

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getExtension(String name) → dynamic

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getFramebufferAttachmentParameter(int target, int attachment, int pname) → dynamic

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getParameter(int pname) → dynamic

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getProgramInfoLog(WebGLProgram program) → String?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getProgramParameter(WebGLProgram program, int pname) → dynamic

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getRenderbufferParameter(int target, int pname) → dynamic

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getShaderInfoLog(WebGLShader shader) → String?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getShaderParameter(WebGLShader shader, int pname) → dynamic

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getShaderPrecisionFormat(int shadertype, int precisiontype) → WebGLShaderPrecisionFormat?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getShaderSource(WebGLShader shader) → String?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getSupportedExtensions() → Iterable<String>

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getTexParameter(int target, int pname) → dynamic

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getUniform(WebGLProgram program, WebGLUniformLocation location) → dynamic

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getUniformLocation(WebGLProgram program, String name) → WebGLUniformLocation?

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getVertexAttrib(int index, int pname) → dynamic

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

getVertexAttribOffset(int index, int pname) → int

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

hint(int target, int mode) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

isBuffer(WebGLBuffer? buffer) → bool

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

isContextLost() → bool

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

isEnabled(int cap) → bool

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

isFramebuffer(WebGLFramebuffer? framebuffer) → bool

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

isProgram(WebGLProgram? program) → bool

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

isRenderbuffer(WebGLRenderbuffer? renderbuffer) → bool

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

isShader(WebGLShader? shader) → bool

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

isTexture(WebGLTexture? texture) → bool

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

lineWidth(dynamic width) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

linkProgram(WebGLProgram program) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

makeXRCompatible() → Future<void>

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
pixelStorei(int pname, int param) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

polygonOffset(dynamic factor, dynamic units) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

readPixels(int x, int y, int width, int height, int format, int type, dynamic pixels) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

renderbufferStorage(int target, int internalformat, int width, int height) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

sampleCoverage(dynamic value, bool invert) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

scissor(int x, int y, int width, int height) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

shaderSource(WebGLShader shader, String source) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

stencilFunc(int func, int ref, int mask) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

stencilFuncSeparate(int face, int func, int ref, int mask) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

stencilMask(int mask) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

stencilMaskSeparate(int face, int mask) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

stencilOp(int fail, int zfail, int zpass) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

stencilOpSeparate(int face, int fail, int zfail, int zpass) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

texImage2D(int target, int level, int internalformat, int width, int height, [int? border, int? format, int? type, dynamic pixels]) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

texParameterf(int target, int pname, dynamic param) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

texParameteri(int target, int pname, int param) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

texSubImage2D(int target, int level, int xoffset, int yoffset, int width, int height, [int? format, int? type, dynamic pixels]) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

toString() → String
A string representation of this object.
inherited
uniform1f(WebGLUniformLocation? location, dynamic x) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

uniform1fv(WebGLUniformLocation? location, dynamic v) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

uniform1i(WebGLUniformLocation? location, int x) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

uniform1iv(WebGLUniformLocation? location, dynamic v) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

uniform2f(WebGLUniformLocation? location, dynamic x, dynamic y) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

uniform2fv(WebGLUniformLocation? location, dynamic v) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

uniform2i(WebGLUniformLocation? location, int x, int y) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

uniform2iv(WebGLUniformLocation? location, dynamic v) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

uniform3f(WebGLUniformLocation? location, dynamic x, dynamic y, dynamic z) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

uniform3fv(WebGLUniformLocation? location, dynamic v) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

uniform3i(WebGLUniformLocation? location, int x, int y, int z) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

uniform3iv(WebGLUniformLocation? location, dynamic v) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

uniform4f(WebGLUniformLocation? location, dynamic x, dynamic y, dynamic z, dynamic w) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

uniform4fv(WebGLUniformLocation? location, dynamic v) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

uniform4i(WebGLUniformLocation? location, int x, int y, int z, int w) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

uniform4iv(WebGLUniformLocation? location, dynamic v) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

uniformMatrix2fv(WebGLUniformLocation? location, bool transpose, dynamic value) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

uniformMatrix3fv(WebGLUniformLocation? location, bool transpose, dynamic value) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

uniformMatrix4fv(WebGLUniformLocation? location, bool transpose, dynamic value) → void

Available on WebGLRenderingContextOverloads, provided by the PropsWebGLRenderingContextOverloads extension

useProgram(WebGLProgram? program) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

validateProgram(WebGLProgram program) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

vertexAttrib1f(int index, dynamic x) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

vertexAttrib1fv(int index, dynamic values) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

vertexAttrib2f(int index, dynamic x, dynamic y) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

vertexAttrib2fv(int index, dynamic values) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

vertexAttrib3f(int index, dynamic x, dynamic y, dynamic z) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

vertexAttrib3fv(int index, dynamic values) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

vertexAttrib4f(int index, dynamic x, dynamic y, dynamic z, dynamic w) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

vertexAttrib4fv(int index, dynamic values) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

vertexAttribPointer(int index, int size, int type, bool normalized, int stride, int offset) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

viewport(int x, int y, int width, int height) → void

Available on WebGLRenderingContextBase, provided by the PropsWebGLRenderingContextBase extension

Operators

operator ==(Object other) → bool
The equality operator.
inherited