RenderingContext

js.html.webgl.RenderingContext (extern class) → WebGL2RenderingContext

The WebGLRenderingContext interface provides the OpenGL ES 2.0 rendering context for the drawing surface of an HTML canvas element.

Documentation WebGLRenderingContext by Mozilla Contributors, licensed under CC-BY-SA 2.5.

See:

Static Members

DEPTH_BUFFER_BIT: Int

STENCIL_BUFFER_BIT: Int

COLOR_BUFFER_BIT: Int

POINTS: Int

LINES: Int

LINE_LOOP: Int

LINE_STRIP: Int

TRIANGLES: Int

TRIANGLE_STRIP: Int

TRIANGLE_FAN: Int

ZERO: Int

ONE: Int

SRC_COLOR: Int

ONE_MINUS_SRC_COLOR: Int

SRC_ALPHA: Int

ONE_MINUS_SRC_ALPHA: Int

DST_ALPHA: Int

ONE_MINUS_DST_ALPHA: Int

DST_COLOR: Int

ONE_MINUS_DST_COLOR: Int

SRC_ALPHA_SATURATE: Int

FUNC_ADD: Int

BLEND_EQUATION: Int

BLEND_EQUATION_RGB: Int

BLEND_EQUATION_ALPHA: Int

FUNC_SUBTRACT: Int

FUNC_REVERSE_SUBTRACT: Int

BLEND_DST_RGB: Int

BLEND_SRC_RGB: Int

BLEND_DST_ALPHA: Int

BLEND_SRC_ALPHA: Int

CONSTANT_COLOR: Int

ONE_MINUS_CONSTANT_COLOR: Int

CONSTANT_ALPHA: Int

ONE_MINUS_CONSTANT_ALPHA: Int

BLEND_COLOR: Int

ARRAY_BUFFER: Int

ELEMENT_ARRAY_BUFFER: Int

ARRAY_BUFFER_BINDING: Int

ELEMENT_ARRAY_BUFFER_BINDING: Int

STREAM_DRAW: Int

STATIC_DRAW: Int

DYNAMIC_DRAW: Int

BUFFER_SIZE: Int

BUFFER_USAGE: Int

CURRENT_VERTEX_ATTRIB: Int

FRONT: Int

BACK: Int

FRONT_AND_BACK: Int

CULL_FACE: Int

BLEND: Int

DITHER: Int

STENCIL_TEST: Int

DEPTH_TEST: Int

SCISSOR_TEST: Int

POLYGON_OFFSET_FILL: Int

SAMPLE_ALPHA_TO_COVERAGE: Int

SAMPLE_COVERAGE: Int

NO_ERROR: Int

INVALID_ENUM: Int

INVALID_VALUE: Int

INVALID_OPERATION: Int

OUT_OF_MEMORY: Int

CW: Int

CCW: Int

LINE_WIDTH: Int

ALIASED_POINT_SIZE_RANGE: Int

ALIASED_LINE_WIDTH_RANGE: Int

CULL_FACE_MODE: Int

FRONT_FACE: Int

DEPTH_RANGE: Int

DEPTH_WRITEMASK: Int

DEPTH_CLEAR_VALUE: Int

DEPTH_FUNC: Int

STENCIL_CLEAR_VALUE: Int

STENCIL_FUNC: Int

STENCIL_FAIL: Int

STENCIL_PASS_DEPTH_FAIL: Int

STENCIL_PASS_DEPTH_PASS: Int

STENCIL_REF: Int

STENCIL_VALUE_MASK: Int

STENCIL_WRITEMASK: Int

STENCIL_BACK_FUNC: Int

STENCIL_BACK_FAIL: Int

STENCIL_BACK_PASS_DEPTH_FAIL: Int

STENCIL_BACK_PASS_DEPTH_PASS: Int

STENCIL_BACK_REF: Int

STENCIL_BACK_VALUE_MASK: Int

STENCIL_BACK_WRITEMASK: Int

VIEWPORT: Int

SCISSOR_BOX: Int

COLOR_CLEAR_VALUE: Int

COLOR_WRITEMASK: Int

UNPACK_ALIGNMENT: Int

PACK_ALIGNMENT: Int

MAX_TEXTURE_SIZE: Int

MAX_VIEWPORT_DIMS: Int

SUBPIXEL_BITS: Int

RED_BITS: Int

GREEN_BITS: Int

BLUE_BITS: Int

ALPHA_BITS: Int

DEPTH_BITS: Int

STENCIL_BITS: Int

POLYGON_OFFSET_UNITS: Int

POLYGON_OFFSET_FACTOR: Int

TEXTURE_BINDING_2D: Int

SAMPLE_BUFFERS: Int

SAMPLES: Int

SAMPLE_COVERAGE_VALUE: Int

SAMPLE_COVERAGE_INVERT: Int

COMPRESSED_TEXTURE_FORMATS: Int

DONT_CARE: Int

FASTEST: Int

NICEST: Int

GENERATE_MIPMAP_HINT: Int

BYTE: Int

UNSIGNED_BYTE: Int

SHORT: Int

UNSIGNED_SHORT: Int

INT: Int

UNSIGNED_INT: Int

FLOAT: Int

DEPTH_COMPONENT: Int

ALPHA: Int

RGB: Int

RGBA: Int

LUMINANCE: Int

LUMINANCE_ALPHA: Int

UNSIGNED_SHORT_4_4_4_4: Int

UNSIGNED_SHORT_5_5_5_1: Int

UNSIGNED_SHORT_5_6_5: Int

FRAGMENT_SHADER: Int

VERTEX_SHADER: Int

MAX_VERTEX_ATTRIBS: Int

MAX_VERTEX_UNIFORM_VECTORS: Int

MAX_VARYING_VECTORS: Int

MAX_COMBINED_TEXTURE_IMAGE_UNITS: Int

MAX_VERTEX_TEXTURE_IMAGE_UNITS: Int

MAX_TEXTURE_IMAGE_UNITS: Int

MAX_FRAGMENT_UNIFORM_VECTORS: Int

SHADER_TYPE: Int

DELETE_STATUS: Int


VALIDATE_STATUS: Int

ATTACHED_SHADERS: Int

ACTIVE_UNIFORMS: Int

ACTIVE_ATTRIBUTES: Int

SHADING_LANGUAGE_VERSION: Int

CURRENT_PROGRAM: Int

NEVER: Int

LESS: Int

EQUAL: Int

LEQUAL: Int

GREATER: Int

NOTEQUAL: Int

GEQUAL: Int

ALWAYS: Int

KEEP: Int

REPLACE: Int

INCR: Int

DECR: Int

INVERT: Int

INCR_WRAP: Int

DECR_WRAP: Int

VENDOR: Int

RENDERER: Int

VERSION: Int

NEAREST: Int

LINEAR: Int

NEAREST_MIPMAP_NEAREST: Int

LINEAR_MIPMAP_NEAREST: Int

NEAREST_MIPMAP_LINEAR: Int

LINEAR_MIPMAP_LINEAR: Int

TEXTURE_MAG_FILTER: Int

TEXTURE_MIN_FILTER: Int

TEXTURE_WRAP_S: Int

TEXTURE_WRAP_T: Int

TEXTURE_2D: Int

TEXTURE: Int

TEXTURE_CUBE_MAP: Int

TEXTURE_BINDING_CUBE_MAP: Int

TEXTURE_CUBE_MAP_POSITIVE_X: Int

TEXTURE_CUBE_MAP_NEGATIVE_X: Int

TEXTURE_CUBE_MAP_POSITIVE_Y: Int

TEXTURE_CUBE_MAP_NEGATIVE_Y: Int

TEXTURE_CUBE_MAP_POSITIVE_Z: Int

TEXTURE_CUBE_MAP_NEGATIVE_Z: Int

MAX_CUBE_MAP_TEXTURE_SIZE: Int

TEXTURE0: Int

TEXTURE1: Int

TEXTURE2: Int

TEXTURE3: Int

TEXTURE4: Int

TEXTURE5: Int

TEXTURE6: Int

TEXTURE7: Int

TEXTURE8: Int

TEXTURE9: Int

TEXTURE10: Int

TEXTURE11: Int

TEXTURE12: Int

TEXTURE13: Int

TEXTURE14: Int

TEXTURE15: Int

TEXTURE16: Int

TEXTURE17: Int

TEXTURE18: Int

TEXTURE19: Int

TEXTURE20: Int

TEXTURE21: Int

TEXTURE22: Int

TEXTURE23: Int

TEXTURE24: Int

TEXTURE25: Int

TEXTURE26: Int

TEXTURE27: Int

TEXTURE28: Int

TEXTURE29: Int

TEXTURE30: Int

TEXTURE31: Int

ACTIVE_TEXTURE: Int

REPEAT: Int

CLAMP_TO_EDGE: Int

MIRRORED_REPEAT: Int

FLOAT_VEC2: Int

FLOAT_VEC3: Int

FLOAT_VEC4: Int

INT_VEC2: Int

INT_VEC3: Int

INT_VEC4: Int

BOOL: Int

BOOL_VEC2: Int

BOOL_VEC3: Int

BOOL_VEC4: Int

FLOAT_MAT2: Int

FLOAT_MAT3: Int

FLOAT_MAT4: Int

SAMPLER_2D: Int

SAMPLER_CUBE: Int

VERTEX_ATTRIB_ARRAY_ENABLED: Int

VERTEX_ATTRIB_ARRAY_SIZE: Int

VERTEX_ATTRIB_ARRAY_STRIDE: Int

VERTEX_ATTRIB_ARRAY_TYPE: Int

VERTEX_ATTRIB_ARRAY_NORMALIZED: Int

VERTEX_ATTRIB_ARRAY_POINTER: Int

VERTEX_ATTRIB_ARRAY_BUFFER_BINDING: Int

IMPLEMENTATION_COLOR_READ_TYPE: Int

IMPLEMENTATION_COLOR_READ_FORMAT: Int

COMPILE_STATUS: Int

LOW_FLOAT: Int

MEDIUM_FLOAT: Int

HIGH_FLOAT: Int

LOW_INT: Int

MEDIUM_INT: Int

HIGH_INT: Int

FRAMEBUFFER: Int

RENDERBUFFER: Int

RGBA4: Int

RGB5_A1: Int

RGB565: Int

DEPTH_COMPONENT16: Int

STENCIL_INDEX8: Int

DEPTH_STENCIL: Int

RENDERBUFFER_WIDTH: Int

RENDERBUFFER_HEIGHT: Int

RENDERBUFFER_INTERNAL_FORMAT: Int

RENDERBUFFER_RED_SIZE: Int

RENDERBUFFER_GREEN_SIZE: Int

RENDERBUFFER_BLUE_SIZE: Int

RENDERBUFFER_ALPHA_SIZE: Int

RENDERBUFFER_DEPTH_SIZE: Int

RENDERBUFFER_STENCIL_SIZE: Int

FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE: Int

FRAMEBUFFER_ATTACHMENT_OBJECT_NAME: Int

FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL: Int

FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE: Int

COLOR_ATTACHMENT0: Int

DEPTH_ATTACHMENT: Int

STENCIL_ATTACHMENT: Int

DEPTH_STENCIL_ATTACHMENT: Int

NONE: Int

FRAMEBUFFER_COMPLETE: Int

FRAMEBUFFER_INCOMPLETE_ATTACHMENT: Int

FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT: Int

FRAMEBUFFER_INCOMPLETE_DIMENSIONS: Int

FRAMEBUFFER_UNSUPPORTED: Int

FRAMEBUFFER_BINDING: Int

RENDERBUFFER_BINDING: Int

MAX_RENDERBUFFER_SIZE: Int

INVALID_FRAMEBUFFER_OPERATION: Int

UNPACK_FLIP_Y_WEBGL: Int

UNPACK_PREMULTIPLY_ALPHA_WEBGL: Int

CONTEXT_LOST_WEBGL: Int

UNPACK_COLORSPACE_CONVERSION_WEBGL: Int

BROWSER_DEFAULT_WEBGL: Int

Instance Members

A read-only back-reference to the HTMLCanvasElement. Might be null if it is not associated with a canvas element.


drawingBufferWidth: Int

The read-only width of the current drawing buffer. Should match the width of the canvas element associated with this context.


drawingBufferHeight: Int

The read-only height of the current drawing buffer. Should match the height of the canvas element associated with this context.


bufferData(target: Int, data: js.lib.ArrayBufferView, usage: Int): Void

Updates buffer data.

Name Type
target Int
data js.lib.ArrayBufferView
usage Int

bufferSubData(target: Int, offset: Int, data: js.lib.ArrayBufferView): Void

Updates buffer data starting at a passed offset.

Name Type
target Int
offset Int
data js.lib.ArrayBufferView

compressedTexImage2D(target: Int, level: Int, internalformat: Int, width: Int, height: Int, border: Int, data: js.lib.ArrayBufferView): Void

Specifies a 2D texture image in a compressed format.

Name Type
target Int
level Int
internalformat Int
width Int
height Int
border Int
data js.lib.ArrayBufferView

compressedTexSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, width: Int, height: Int, format: Int, data: js.lib.ArrayBufferView): Void

Specifies a 2D texture sub-image in a compressed format.

Name Type
target Int
level Int
xoffset Int
yoffset Int
width Int
height Int
format Int
data js.lib.ArrayBufferView

readPixels(x: Int, y: Int, width: Int, height: Int, format: Int, type: Int, pixels: js.lib.ArrayBufferView): Void

Reads a block of pixels from the WebGLFrameBuffer.

Name Type
x Int
y Int
width Int
height Int
format Int
type Int
pixels js.lib.ArrayBufferView

texImage2D(target: Int, level: Int, internalformat: Int, format: Int, type: Int, video: js.html.VideoElement): Void

Specifies a 2D texture image.

Name Type
target Int
level Int
internalformat Int
format Int
type Int
video js.html.VideoElement

texSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, format: Int, type: Int, video: js.html.VideoElement): Void

Updates a sub-rectangle of the current WebGLTexture.

Name Type
target Int
level Int
xoffset Int
yoffset Int
format Int
type Int
video js.html.VideoElement

uniform1fv(location: UniformLocation, data: js.lib.Float32Array): Void
Name Type
location UniformLocation
data js.lib.Float32Array

uniform2fv(location: UniformLocation, data: js.lib.Float32Array): Void
Name Type
location UniformLocation
data js.lib.Float32Array

uniform3fv(location: UniformLocation, data: js.lib.Float32Array): Void
Name Type
location UniformLocation
data js.lib.Float32Array

uniform4fv(location: UniformLocation, data: js.lib.Float32Array): Void
Name Type
location UniformLocation
data js.lib.Float32Array

uniform1iv(location: UniformLocation, data: js.lib.Int32Array): Void
Name Type
location UniformLocation
data js.lib.Int32Array

uniform2iv(location: UniformLocation, data: js.lib.Int32Array): Void
Name Type
location UniformLocation
data js.lib.Int32Array

uniform3iv(location: UniformLocation, data: js.lib.Int32Array): Void
Name Type
location UniformLocation
data js.lib.Int32Array

uniform4iv(location: UniformLocation, data: js.lib.Int32Array): Void
Name Type
location UniformLocation
data js.lib.Int32Array

uniformMatrix2fv(location: UniformLocation, transpose: Bool, data: js.lib.Float32Array): Void
Name Type
location UniformLocation
transpose Bool
data js.lib.Float32Array

uniformMatrix3fv(location: UniformLocation, transpose: Bool, data: js.lib.Float32Array): Void
Name Type
location UniformLocation
transpose Bool
data js.lib.Float32Array

uniformMatrix4fv(location: UniformLocation, transpose: Bool, data: js.lib.Float32Array): Void
Name Type
location UniformLocation
transpose Bool
data js.lib.Float32Array

getContextAttributes(): ContextAttributes

Returns a WebGLContextAttributes object that contains the actual context parameters. Might return null, if the context is lost.

Returns
ContextAttributes

isContextLost(): Bool

Returns true if the context is lost, otherwise returns false.

Returns
Bool

getSupportedExtensions(): Array<String>

Returns an Array of DOMString elements with all the supported WebGL extensions.

Returns
Array<String>

getExtension(name: Extension<getExtension.T>): getExtension.T

Returns an extension object.

Name Type
name Extension<getExtension.T>
Returns
getExtension.T

activeTexture(texture: Int): Void

Selects the active texture unit.

Name Type
texture Int

attachShader(program: Program, shader: Shader): Void

Attaches a WebGLShader to a WebGLProgram.

Name Type
program Program
shader Shader

bindAttribLocation(program: Program, index: Int, name: String): Void

Binds a generic vertex index to a named attribute variable.

Name Type
program Program
index Int
name String

bindBuffer(target: Int, buffer: Buffer): Void

Binds a WebGLBuffer object to a given target.

Name Type
target Int
buffer Buffer

bindFramebuffer(target: Int, framebuffer: Framebuffer): Void

Binds a WebGLFrameBuffer object to a given target.

Name Type
target Int
framebuffer Framebuffer

bindRenderbuffer(target: Int, renderbuffer: Renderbuffer): Void

Binds a WebGLRenderBuffer object to a given target.

Name Type
target Int
renderbuffer Renderbuffer

bindTexture(target: Int, texture: Texture): Void

Binds a WebGLTexture object to a given target.

Name Type
target Int
texture Texture

blendColor(red: Float, green: Float, blue: Float, alpha: Float): Void

Sets the source and destination blending factors.

Name Type
red Float
green Float
blue Float
alpha Float

blendEquation(mode: Int): Void

Sets both the RGB blend equation and alpha blend equation to a single equation.

Name Type
mode Int

blendEquationSeparate(modeRGB: Int, modeAlpha: Int): Void

Sets the RGB blend equation and alpha blend equation separately.

Name Type
modeRGB Int
modeAlpha Int

blendFunc(sfactor: Int, dfactor: Int): Void

Defines which function is used for blending pixel arithmetic.

Name Type
sfactor Int
dfactor Int

blendFuncSeparate(srcRGB: Int, dstRGB: Int, srcAlpha: Int, dstAlpha: Int): Void

Defines which function is used for blending pixel arithmetic for RGB and alpha components separately.

Name Type
srcRGB Int
dstRGB Int
srcAlpha Int
dstAlpha Int

checkFramebufferStatus(target: Int): Int

Returns the status of the framebuffer.

Name Type
target Int
Returns
Int

clear(mask: Int): Void

Clears specified buffers to preset values.

Name Type
mask Int

clearColor(red: Float, green: Float, blue: Float, alpha: Float): Void

Specifies the color values used when clearing color buffers.

Name Type
red Float
green Float
blue Float
alpha Float

clearDepth(depth: Float): Void

Specifies the depth value used when clearing the depth buffer.

Name Type
depth Float

clearStencil(s: Int): Void

Specifies the stencil value used when clearing the stencil buffer.

Name Type
s Int

colorMask(red: Bool, green: Bool, blue: Bool, alpha: Bool): Void

Sets which color components to enable or to disable when drawing or rendering to a WebGLFramebuffer.

Name Type
red Bool
green Bool
blue Bool
alpha Bool

compileShader(shader: Shader): Void

Compiles a WebGLShader.

Name Type
shader Shader

copyTexImage2D(target: Int, level: Int, internalformat: Int, x: Int, y: Int, width: Int, height: Int, border: Int): Void

Copies a 2D texture image.

Name Type
target Int
level Int
internalformat Int
x Int
y Int
width Int
height Int
border Int

copyTexSubImage2D(target: Int, level: Int, xoffset: Int, yoffset: Int, x: Int, y: Int, width: Int, height: Int): Void

Copies a 2D texture sub-image.

Name Type
target Int
level Int
xoffset Int
yoffset Int
x Int
y Int
width Int
height Int

createBuffer(): Buffer

Creates a WebGLBuffer object.

Returns
Buffer

createFramebuffer(): Framebuffer

Creates a WebGLFrameBuffer object.

Returns
Framebuffer

createProgram(): Program

Creates a WebGLProgram.

Returns
Program

createRenderbuffer(): Renderbuffer

Creates a WebGLRenderBuffer object.

Returns
Renderbuffer

createShader(type: Int): Shader

Creates a WebGLShader.

Name Type
type Int
Returns
Shader

createTexture(): Texture

Creates a WebGLTexture object.

Returns
Texture

cullFace(mode: Int): Void

Specifies whether or not front- and/or back-facing polygons can be culled.

Name Type
mode Int

deleteBuffer(buffer: Buffer): Void

Deletes a WebGLBuffer object.

Name Type
buffer Buffer

deleteFramebuffer(framebuffer: Framebuffer): Void

Deletes a WebGLFrameBuffer object.

Name Type
framebuffer Framebuffer

deleteProgram(program: Program): Void

Deletes a WebGLProgram.

Name Type
program Program

deleteRenderbuffer(renderbuffer: Renderbuffer): Void

Deletes a WebGLRenderBuffer object.

Name Type
renderbuffer Renderbuffer

deleteShader(shader: Shader): Void

Deletes a WebGLShader.

Name Type
shader Shader

deleteTexture(texture: Texture): Void

Deletes a WebGLTexture object.

Name Type
texture Texture

depthFunc(func: Int): Void

Specifies a function that compares incoming pixel depth to the current depth buffer value.

Name Type
func Int

depthMask(flag: Bool): Void

Sets whether writing into the depth buffer is enabled or disabled.

Name Type
flag Bool

depthRange(zNear: Float, zFar: Float): Void

Specifies the depth range mapping from normalized device coordinates to window or viewport coordinates.

Name Type
zNear Float
zFar Float

detachShader(program: Program, shader: Shader): Void

Detaches a WebGLShader.

Name Type
program Program
shader Shader

disable(cap: Int): Void

Disables specific WebGL capabilities for this context.

Name Type
cap Int

disableVertexAttribArray(index: Int): Void

Disables a vertex attribute array at a given position.

Name Type
index Int

drawArrays(mode: Int, first: Int, count: Int): Void

Renders primitives from array data.

Name Type
mode Int
first Int
count Int

drawElements(mode: Int, count: Int, type: Int, offset: Int): Void

Renders primitives from element array data.

Name Type
mode Int
count Int
type Int
offset Int

enable(cap: Int): Void

Enables specific WebGL capabilities for this context.

Name Type
cap Int

enableVertexAttribArray(index: Int): Void

Enables a vertex attribute array at a given position.

Name Type
index Int

finish(): Void

Blocks execution until all previously called commands are finished.


flush(): Void

Empties different buffer commands, causing all commands to be executed as quickly as possible.


framebufferRenderbuffer(target: Int, attachment: Int, renderbuffertarget: Int, renderbuffer: Renderbuffer): Void

Attaches a WebGLRenderingBuffer object to a WebGLFrameBuffer object.

Name Type
target Int
attachment Int
renderbuffertarget Int
renderbuffer Renderbuffer

framebufferTexture2D(target: Int, attachment: Int, textarget: Int, texture: Texture, level: Int): Void

Attaches a textures image to a WebGLFrameBuffer object.

Name Type
target Int
attachment Int
textarget Int
texture Texture
level Int

frontFace(mode: Int): Void

Specifies whether polygons are front- or back-facing by setting a winding orientation.

Name Type
mode Int

generateMipmap(target: Int): Void

Generates a set of mipmaps for a WebGLTexture object.

Name Type
target Int

getActiveAttrib(program: Program, index: Int): ActiveInfo

Returns information about an active attribute variable.

Name Type
program Program
index Int
Returns
ActiveInfo

getActiveUniform(program: Program, index: Int): ActiveInfo

Returns information about an active uniform variable.

Name Type
program Program
index Int
Returns
ActiveInfo

getAttachedShaders(program: Program): Array<Shader>

Returns a list of WebGLShader objects attached to a WebGLProgram.

Name Type
program Program
Returns
Array<Shader>

getAttribLocation(program: Program, name: String): Int

Returns the location of an attribute variable.

Name Type
program Program
name String
Returns
Int

getBufferParameter(target: Int, pname: Int): Dynamic

Returns information about the buffer.

Name Type
target Int
pname Int
Returns
Dynamic

getParameter(pname: Int): Dynamic

Returns a value for the passed parameter name.

Name Type
pname Int
Returns
Dynamic

getError(): Int

Returns error information.

Returns
Int

getFramebufferAttachmentParameter(target: Int, attachment: Int, pname: Int): Dynamic

Returns information about the framebuffer.

Name Type
target Int
attachment Int
pname Int
Returns
Dynamic

getProgramParameter(program: Program, pname: Int): Dynamic

Returns information about the program.

Name Type
program Program
pname Int
Returns
Dynamic

getProgramInfoLog(program: Program): String

Returns the information log for a WebGLProgram object.

Name Type
program Program
Returns
String

getRenderbufferParameter(target: Int, pname: Int): Dynamic

Returns information about the renderbuffer.

Name Type
target Int
pname Int
Returns
Dynamic

getShaderParameter(shader: Shader, pname: Int): Dynamic

Returns information about the shader.

Name Type
shader Shader
pname Int
Returns
Dynamic

getShaderPrecisionFormat(shadertype: Int, precisiontype: Int): ShaderPrecisionFormat

Returns a WebGLShaderPrecisionFormat object describing the precision for the numeric format of the shader.

Name Type
shadertype Int
precisiontype Int
Returns
ShaderPrecisionFormat

getShaderInfoLog(shader: Shader): String

Returns the information log for a WebGLShader object.

Name Type
shader Shader
Returns
String

getShaderSource(shader: Shader): String

Returns the source code of a WebGLShader as a string.

Name Type
shader Shader
Returns
String

getTexParameter(target: Int, pname: Int): Dynamic

Returns information about the texture.

Name Type
target Int
pname Int
Returns
Dynamic

getUniform(program: Program, location: UniformLocation): Dynamic

Returns the value of a uniform variable at a given location.

Name Type
program Program
location UniformLocation
Returns
Dynamic

getUniformLocation(program: Program, name: String): UniformLocation

Returns the location of a uniform variable.

Name Type
program Program
name String
Returns
UniformLocation

getVertexAttrib(index: Int, pname: Int): Dynamic

Returns information about a vertex attribute at a given position.

Name Type
index Int
pname Int
Returns
Dynamic

getVertexAttribOffset(index: Int, pname: Int): Int

Returns the address of a given vertex attribute.

Name Type
index Int
pname Int
Returns
Int

hint(target: Int, mode: Int): Void

Specifies hints for certain behaviors. The interpretation of these hints depend on the implementation.

Name Type
target Int
mode Int

isBuffer(buffer: Buffer): Bool

Returns a Boolean indicating if the passed buffer is valid.

Name Type
buffer Buffer
Returns
Bool

isEnabled(cap: Int): Bool

Tests whether a specific WebGL capability is enabled or not for this context.

Name Type
cap Int
Returns
Bool

isFramebuffer(framebuffer: Framebuffer): Bool

Returns a Boolean indicating if the passed WebGLFrameBuffer object is valid.

Name Type
framebuffer Framebuffer
Returns
Bool

isProgram(program: Program): Bool

Returns a Boolean indicating if the passed WebGLProgram is valid.

Name Type
program Program
Returns
Bool

isRenderbuffer(renderbuffer: Renderbuffer): Bool

Returns a Boolean indicating if the passed WebGLRenderingBuffer is valid.

Name Type
renderbuffer Renderbuffer
Returns
Bool

isShader(shader: Shader): Bool

Returns a Boolean indicating if the passed WebGLShader is valid.

Name Type
shader Shader
Returns
Bool

isTexture(texture: Texture): Bool

Returns a Boolean indicating if the passed WebGLTexture is valid.

Name Type
texture Texture
Returns
Bool

lineWidth(width: Float): Void

Sets the line width of rasterized lines.

Name Type
width Float

linkProgram(program: Program): Void

Links the passed WebGLProgram object.

Name Type
program Program

pixelStorei(pname: Int, param: Int): Void

Specifies the pixel storage modes

Name Type
pname Int
param Int

polygonOffset(factor: Float, units: Float): Void

Specifies the scale factors and units to calculate depth values.

Name Type
factor Float
units Float

renderbufferStorage(target: Int, internalformat: Int, width: Int, height: Int): Void

Creates a renderbuffer data store.

Name Type
target Int
internalformat Int
width Int
height Int

sampleCoverage(value: Float, invert: Bool): Void

Specifies multi-sample coverage parameters for anti-aliasing effects.

Name Type
value Float
invert Bool

scissor(x: Int, y: Int, width: Int, height: Int): Void

Defines the scissor box.

Name Type
x Int
y Int
width Int
height Int

shaderSource(shader: Shader, source: String): Void

Sets the source code in a WebGLShader.

Name Type
shader Shader
source String

stencilFunc(func: Int, ref: Int, mask: Int): Void

Sets the both front and back function and reference value for stencil testing.

Name Type
func Int
ref Int
mask Int

stencilFuncSeparate(face: Int, func: Int, ref: Int, mask: Int): Void

Sets the front and/or back function and reference value for stencil testing.

Name Type
face Int
func Int
ref Int
mask Int

stencilMask(mask: Int): Void

Controls enabling and disabling of both the front and back writing of individual bits in the stencil planes.

Name Type
mask Int

stencilMaskSeparate(face: Int, mask: Int): Void

Controls enabling and disabling of front and/or back writing of individual bits in the stencil planes.

Name Type
face Int
mask Int

stencilOp(fail: Int, zfail: Int, zpass: Int): Void

Sets both the front and back-facing stencil test actions.

Name Type
fail Int
zfail Int
zpass Int

stencilOpSeparate(face: Int, fail: Int, zfail: Int, zpass: Int): Void

Sets the front and/or back-facing stencil test actions.

Name Type
face Int
fail Int
zfail Int
zpass Int

texParameterf(target: Int, pname: Int, param: Float): Void
Name Type
target Int
pname Int
param Float

texParameteri(target: Int, pname: Int, param: Int): Void
Name Type
target Int
pname Int
param Int

uniform1f(location: UniformLocation, x: Float): Void
Name Type
location UniformLocation
x Float

uniform2f(location: UniformLocation, x: Float, y: Float): Void
Name Type
location UniformLocation
x Float
y Float

uniform3f(location: UniformLocation, x: Float, y: Float, z: Float): Void
Name Type
location UniformLocation
x Float
y Float
z Float

uniform4f(location: UniformLocation, x: Float, y: Float, z: Float, w: Float): Void
Name Type
location UniformLocation
x Float
y Float
z Float
w Float

uniform1i(location: UniformLocation, x: Int): Void
Name Type
location UniformLocation
x Int

uniform2i(location: UniformLocation, x: Int, y: Int): Void
Name Type
location UniformLocation
x Int
y Int

uniform3i(location: UniformLocation, x: Int, y: Int, z: Int): Void
Name Type
location UniformLocation
x Int
y Int
z Int

uniform4i(location: UniformLocation, x: Int, y: Int, z: Int, w: Int): Void
Name Type
location UniformLocation
x Int
y Int
z Int
w Int

useProgram(program: Program): Void

Uses the specified WebGLProgram as part the current rendering state.

Name Type
program Program

validateProgram(program: Program): Void

Validates a WebGLProgram.

Name Type
program Program

vertexAttrib1f(indx: Int, x: Float): Void
Name Type
indx Int
x Float

vertexAttrib1fv(indx: Int, values: js.lib.Float32Array): Void
Name Type
indx Int
values js.lib.Float32Array

vertexAttrib2f(indx: Int, x: Float, y: Float): Void
Name Type
indx Int
x Float
y Float

vertexAttrib2fv(indx: Int, values: js.lib.Float32Array): Void
Name Type
indx Int
values js.lib.Float32Array

vertexAttrib3f(indx: Int, x: Float, y: Float, z: Float): Void
Name Type
indx Int
x Float
y Float
z Float

vertexAttrib3fv(indx: Int, values: js.lib.Float32Array): Void
Name Type
indx Int
values js.lib.Float32Array

vertexAttrib4f(indx: Int, x: Float, y: Float, z: Float, w: Float): Void
Name Type
indx Int
x Float
y Float
z Float
w Float

vertexAttrib4fv(indx: Int, values: js.lib.Float32Array): Void
Name Type
indx Int
values js.lib.Float32Array

vertexAttribPointer(indx: Int, size: Int, type: Int, normalized: Bool, stride: Int, offset: Int): Void

Specifies the data formats and locations of vertex attributes in a vertex attributes array.

Name Type
indx Int
size Int
type Int
normalized Bool
stride Int
offset Int

viewport(x: Int, y: Int, width: Int, height: Int): Void

Sets the viewport.

Name Type
x Int
y Int
width Int
height Int