class WebGL2RenderingContext
package js.html.webgl
extends RenderingContext
Available on js
The WebGL2RenderingContext interface provides the OpenGL ES 3.0 rendering context for the drawing surface of an HTML canvas
element.
Documentation WebGL2RenderingContext by Mozilla Contributors, licensed under CC-BY-SA 2.5.
See also:
Static variables
Methods
bindBufferBase(target:Int, index:Int, buffer:Buffer):Void
Binds a given WebGLBuffer
to a given binding point (target
) at a given index
.
bindBufferRange(target:Int, index:Int, buffer:Buffer, offset:Int, size:Int):Void
Binds a range of a given WebGLBuffer
to a given binding point (target
) at a given index
.
bindTransformFeedback(target:Int, tf:TransformFeedback):Void
Binds a passed WebGLTransformFeedback
object to the current GL state.
blitFramebuffer(srcX0:Int, srcY0:Int, srcX1:Int, srcY1:Int, dstX0:Int, dstY0:Int, dstX1:Int, dstY1:Int, mask:Int, filter:Int):Void
Transfers a block of pixels from the read framebuffer to the draw framebuffer.
bufferData(target:Int, srcData:ArrayBufferView, usage:Int, srcOffset:Int, length:Int = 0):Void
bufferData(target:Int, size:Int, usage:Int):Void
bufferData(target:Int, srcData:ArrayBuffer, usage:Int):Void
bufferData(target:Int, srcData:ArrayBufferView, usage:Int):Void
Initializes and creates the buffer object's data store.
bufferSubData(target:Int, dstByteOffset:Int, srcData:ArrayBufferView, srcOffset:Int, length:Int = 0):Void
bufferSubData(target:Int, offset:Int, srcData:ArrayBuffer):Void
bufferSubData(target:Int, offset:Int, srcData:ArrayBufferView):Void
Updates a subset of a buffer object's data store.
clearBufferfv(buffer:Int, drawbuffer:Int, values:Float32Array, srcOffset:Int = 0):Void
clearBufferfv(buffer:Int, drawbuffer:Int, values:Array<Float>, srcOffset:Int = 0):Void
clearBufferiv(buffer:Int, drawbuffer:Int, values:Int32Array, srcOffset:Int = 0):Void
clearBufferiv(buffer:Int, drawbuffer:Int, values:Array<Int>, srcOffset:Int = 0):Void
clearBufferuiv(buffer:Int, drawbuffer:Int, values:Uint32Array, srcOffset:Int = 0):Void
clearBufferuiv(buffer:Int, drawbuffer:Int, values:Array<Int>, srcOffset:Int = 0):Void
clientWaitSync(sync:Sync, flags:Int, timeout:Int):Int
Blocks and waits for a WebGLSync
object to become signaled or a given timeout to be passed.
compressedTexImage3D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, depth:Int, border:Int, srcData:ArrayBufferView, srcOffset:Int = 0, srcLengthOverride:Int = 0):Void
compressedTexImage3D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, depth:Int, border:Int, imageSize:Int, offset:Int):Void
Specifies a three-dimensional texture image in a compressed format.
compressedTexSubImage3D(target:Int, level:Int, xoffset:Int, yoffset:Int, zoffset:Int, width:Int, height:Int, depth:Int, format:Int, srcData:ArrayBufferView, srcOffset:Int = 0, srcLengthOverride:Int = 0):Void
compressedTexSubImage3D(target:Int, level:Int, xoffset:Int, yoffset:Int, zoffset:Int, width:Int, height:Int, depth:Int, format:Int, imageSize:Int, offset:Int):Void
Specifies a three-dimensional sub-rectangle for a texture image in a compressed format.
copyBufferSubData(readTarget:Int, writeTarget:Int, readOffset:Int, writeOffset:Int, size:Int):Void
Copies part of the data of a buffer to another buffer.
copyTexSubImage3D(target:Int, level:Int, xoffset:Int, yoffset:Int, zoffset:Int, x:Int, y:Int, width:Int, height:Int):Void
Copies pixels from the current WebGLFramebuffer
into an existing 3D texture sub-image.
drawArraysInstanced(mode:Int, first:Int, count:Int, instanceCount:Int):Void
Renders primitives from array data. In addition, it can execute multiple instances of the range of elements.
drawElementsInstanced(mode:Int, count:Int, type:Int, offset:Int, instanceCount:Int):Void
Renders primitives from array data. In addition, it can execute multiple instances of a set of elements.
drawRangeElements(mode:Int, start:Int, end:Int, count:Int, type:Int, offset:Int):Void
Renders primitives from array data in a given range.
fenceSync(condition:Int, flags:Int):Sync
Creates a new WebGLSync
object and inserts it into the GL command stream.
framebufferTextureLayer(target:Int, attachment:Int, texture:Texture, level:Int, layer:Int):Void
Attaches a single layer of a texture to a framebuffer.
getActiveUniformBlockName(program:Program, uniformBlockIndex:Int):String
Retrieves the name of the active uniform block at a given index within a WebGLProgram
.
getActiveUniformBlockParameter(program:Program, uniformBlockIndex:Int, pname:Int):Dynamic
Retrieves information about an active uniform block within a WebGLProgram
.
Throws:
null | DOMError |
---|
getActiveUniforms(program:Program, uniformIndices:Array<Int>, pname:Int):Dynamic
Retrieves information about active uniforms within a WebGLProgram
.
getBufferSubData(target:Int, srcByteOffset:Int, dstData:ArrayBufferView, dstOffset:Int = 0, length:Int = 0):Void
Reads data from a buffer and writes them to an ArrayBuffer
or SharedArrayBuffer
.
getFragDataLocation(program:Program, name:String):Int
Returns the binding of color numbers to user-defined varying out variables.
getIndexedParameter(target:Int, index:Int):Dynamic
Returns the indexed value for the given target
.
Throws:
null | DOMError |
---|
getInternalformatParameter(target:Int, internalformat:Int, pname:Int):Dynamic
Returns information about implementation-dependent support for internal formats.
Throws:
null | DOMError |
---|
getTransformFeedbackVarying(program:Program, index:Int):ActiveInfo
Returns information about varying variables from WebGLTransformFeedback
buffers.
getUniformBlockIndex(program:Program, uniformBlockName:String):Int
Retrieves the index of a uniform block within a WebGLProgram
.
getUniformIndices(program:Program, uniformNames:Array<String>):Array<Int>
Retrieves the indices of a number of uniforms within a WebGLProgram
.
invalidateFramebuffer(target:Int, attachments:Array<Int>):Void
Invalidates the contents of attachments in a framebuffer.
Throws:
null | DOMError |
---|
invalidateSubFramebuffer(target:Int, attachments:Array<Int>, x:Int, y:Int, width:Int, height:Int):Void
Invalidates portions of the contents of attachments in a framebuffer
Throws:
null | DOMError |
---|
isTransformFeedback(tf:TransformFeedback):Bool
Returns true
if the passed object is a valid WebGLTransformFeedback
object.
isVertexArray(vertexArray:VertexArrayObject):Bool
Returns true
if a given object is a valid WebGLVertexArrayObject
.
readPixels(x:Int, y:Int, width:Int, height:Int, format:Int, type:Int, dstData:ArrayBufferView, dstOffset:Int):Void
readPixels(x:Int, y:Int, width:Int, height:Int, format:Int, type:Int, dstData:ArrayBufferView):Void
readPixels(x:Int, y:Int, width:Int, height:Int, format:Int, type:Int, offset:Int):Void
Throws:
null | DOMError |
---|
renderbufferStorageMultisample(target:Int, samples:Int, internalformat:Int, width:Int, height:Int):Void
Creates and initializes a renderbuffer object's data store and allows specifying the number of samples to be used.
texImage2D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, border:Int, format:Int, type:Int, srcData:ArrayBufferView, srcOffset:Int):Void
texImage2D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, border:Int, format:Int, type:Int, pixels:ArrayBufferView):Void
texImage2D(target:Int, level:Int, internalformat:Int, format:Int, type:Int, source:CanvasElement):Void
texImage2D(target:Int, level:Int, internalformat:Int, format:Int, type:Int, source:ImageElement):Void
texImage2D(target:Int, level:Int, internalformat:Int, format:Int, type:Int, source:VideoElement):Void
texImage2D(target:Int, level:Int, internalformat:Int, format:Int, type:Int, source:ImageBitmap):Void
texImage2D(target:Int, level:Int, internalformat:Int, format:Int, type:Int, source:ImageData):Void
texImage2D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, border:Int, format:Int, type:Int, pboOffset:Int):Void
texImage2D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, border:Int, format:Int, type:Int, source:CanvasElement):Void
texImage2D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, border:Int, format:Int, type:Int, source:ImageElement):Void
texImage2D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, border:Int, format:Int, type:Int, source:VideoElement):Void
texImage2D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, border:Int, format:Int, type:Int, source:ImageBitmap):Void
texImage2D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, border:Int, format:Int, type:Int, source:ImageData):Void
Throws:
null | DOMError |
---|
texImage3D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, depth:Int, border:Int, format:Int, type:Int, srcData:ArrayBufferView, srcOffset:Int):Void
texImage3D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, depth:Int, border:Int, format:Int, type:Int, pboOffset:Int):Void
texImage3D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, depth:Int, border:Int, format:Int, type:Int, source:CanvasElement):Void
texImage3D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, depth:Int, border:Int, format:Int, type:Int, source:ImageElement):Void
texImage3D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, depth:Int, border:Int, format:Int, type:Int, source:VideoElement):Void
texImage3D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, depth:Int, border:Int, format:Int, type:Int, source:ImageBitmap):Void
texImage3D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, depth:Int, border:Int, format:Int, type:Int, source:ImageData):Void
texImage3D(target:Int, level:Int, internalformat:Int, width:Int, height:Int, depth:Int, border:Int, format:Int, type:Int, srcData:ArrayBufferView):Void
Specifies a three-dimensional texture image.
Throws:
null | DOMError |
---|
texStorage2D(target:Int, levels:Int, internalformat:Int, width:Int, height:Int):Void
Specifies all levels of two-dimensional texture storage.
texStorage3D(target:Int, levels:Int, internalformat:Int, width:Int, height:Int, depth:Int):Void
Specifies all levels of a three-dimensional texture or two-dimensional array texture.
texSubImage2D(target:Int, level:Int, xoffset:Int, yoffset:Int, width:Int, height:Int, format:Int, type:Int, srcData:ArrayBufferView, srcOffset:Int):Void
texSubImage2D(target:Int, level:Int, xoffset:Int, yoffset:Int, width:Int, height:Int, format:Int, type:Int, pixels:ArrayBufferView):Void
texSubImage2D(target:Int, level:Int, xoffset:Int, yoffset:Int, format:Int, type:Int, source:CanvasElement):Void
texSubImage2D(target:Int, level:Int, xoffset:Int, yoffset:Int, format:Int, type:Int, source:ImageElement):Void
texSubImage2D(target:Int, level:Int, xoffset:Int, yoffset:Int, format:Int, type:Int, source:VideoElement):Void
texSubImage2D(target:Int, level:Int, xoffset:Int, yoffset:Int, format:Int, type:Int, source:ImageBitmap):Void
texSubImage2D(target:Int, level:Int, xoffset:Int, yoffset:Int, format:Int, type:Int, source:ImageData):Void
texSubImage2D(target:Int, level:Int, xoffset:Int, yoffset:Int, width:Int, height:Int, format:Int, type:Int, pboOffset:Int):Void
texSubImage2D(target:Int, level:Int, xoffset:Int, yoffset:Int, width:Int, height:Int, format:Int, type:Int, source:CanvasElement):Void
texSubImage2D(target:Int, level:Int, xoffset:Int, yoffset:Int, width:Int, height:Int, format:Int, type:Int, source:ImageElement):Void
texSubImage2D(target:Int, level:Int, xoffset:Int, yoffset:Int, width:Int, height:Int, format:Int, type:Int, source:VideoElement):Void
texSubImage2D(target:Int, level:Int, xoffset:Int, yoffset:Int, width:Int, height:Int, format:Int, type:Int, source:ImageBitmap):Void
texSubImage2D(target:Int, level:Int, xoffset:Int, yoffset:Int, width:Int, height:Int, format:Int, type:Int, source:ImageData):Void
Throws:
null | DOMError |
---|
texSubImage3D(target:Int, level:Int, xoffset:Int, yoffset:Int, zoffset:Int, width:Int, height:Int, depth:Int, format:Int, type:Int, srcData:ArrayBufferView, srcOffset:Int = 0):Void
texSubImage3D(target:Int, level:Int, xoffset:Int, yoffset:Int, zoffset:Int, width:Int, height:Int, depth:Int, format:Int, type:Int, pboOffset:Int):Void
texSubImage3D(target:Int, level:Int, xoffset:Int, yoffset:Int, zoffset:Int, width:Int, height:Int, depth:Int, format:Int, type:Int, source:CanvasElement):Void
texSubImage3D(target:Int, level:Int, xoffset:Int, yoffset:Int, zoffset:Int, width:Int, height:Int, depth:Int, format:Int, type:Int, source:ImageElement):Void
texSubImage3D(target:Int, level:Int, xoffset:Int, yoffset:Int, zoffset:Int, width:Int, height:Int, depth:Int, format:Int, type:Int, source:VideoElement):Void
texSubImage3D(target:Int, level:Int, xoffset:Int, yoffset:Int, zoffset:Int, width:Int, height:Int, depth:Int, format:Int, type:Int, source:ImageBitmap):Void
texSubImage3D(target:Int, level:Int, xoffset:Int, yoffset:Int, zoffset:Int, width:Int, height:Int, depth:Int, format:Int, type:Int, source:ImageData):Void
Specifies a sub-rectangle of the current 3D texture.
Throws:
null | DOMError |
---|
transformFeedbackVaryings(program:Program, varyings:Array<String>, bufferMode:Int):Void
Specifies values to record in WebGLTransformFeedback
buffers.
uniform1uiv(location:UniformLocation, data:Uint32Array, srcOffset:Int = 0, srcLength:Int = 0):Void
uniform1uiv(location:UniformLocation, data:Array<Int>, srcOffset:Int = 0, srcLength:Int = 0):Void
uniform2uiv(location:UniformLocation, data:Uint32Array, srcOffset:Int = 0, srcLength:Int = 0):Void
uniform2uiv(location:UniformLocation, data:Array<Int>, srcOffset:Int = 0, srcLength:Int = 0):Void
uniform3uiv(location:UniformLocation, data:Uint32Array, srcOffset:Int = 0, srcLength:Int = 0):Void
uniform3uiv(location:UniformLocation, data:Array<Int>, srcOffset:Int = 0, srcLength:Int = 0):Void
uniform4uiv(location:UniformLocation, data:Uint32Array, srcOffset:Int = 0, srcLength:Int = 0):Void
uniform4uiv(location:UniformLocation, data:Array<Int>, srcOffset:Int = 0, srcLength:Int = 0):Void
uniformBlockBinding(program:Program, uniformBlockIndex:Int, uniformBlockBinding:Int):Void
Assigns binding points for active uniform blocks.
uniformMatrix2x3fv(location:UniformLocation, transpose:Bool, data:Float32Array, srcOffset:Int = 0, srcLength:Int = 0):Void
uniformMatrix2x3fv(location:UniformLocation, transpose:Bool, data:Array<Float>, srcOffset:Int = 0, srcLength:Int = 0):Void
uniformMatrix2x4fv(location:UniformLocation, transpose:Bool, data:Float32Array, srcOffset:Int = 0, srcLength:Int = 0):Void
uniformMatrix2x4fv(location:UniformLocation, transpose:Bool, data:Array<Float>, srcOffset:Int = 0, srcLength:Int = 0):Void
uniformMatrix3x2fv(location:UniformLocation, transpose:Bool, data:Float32Array, srcOffset:Int = 0, srcLength:Int = 0):Void
uniformMatrix3x2fv(location:UniformLocation, transpose:Bool, data:Array<Float>, srcOffset:Int = 0, srcLength:Int = 0):Void
uniformMatrix3x4fv(location:UniformLocation, transpose:Bool, data:Float32Array, srcOffset:Int = 0, srcLength:Int = 0):Void
uniformMatrix3x4fv(location:UniformLocation, transpose:Bool, data:Array<Float>, srcOffset:Int = 0, srcLength:Int = 0):Void
uniformMatrix4x2fv(location:UniformLocation, transpose:Bool, data:Float32Array, srcOffset:Int = 0, srcLength:Int = 0):Void
uniformMatrix4x2fv(location:UniformLocation, transpose:Bool, data:Array<Float>, srcOffset:Int = 0, srcLength:Int = 0):Void
uniformMatrix4x3fv(location:UniformLocation, transpose:Bool, data:Float32Array, srcOffset:Int = 0, srcLength:Int = 0):Void
uniformMatrix4x3fv(location:UniformLocation, transpose:Bool, data:Array<Float>, srcOffset:Int = 0, srcLength:Int = 0):Void
vertexAttribDivisor(index:Int, divisor:Int):Void
Modifies the rate at which generic vertex attributes advance when rendering multiple instances of primitives with WebGL2RenderingContext.drawArraysInstanced()
and WebGL2RenderingContext.drawElementsInstanced()
.