Methods

The WebGL method reference documentation.

In this section

TopicDescription

activeTexture

Specifies the active texture unit.

attachShader

Attaches a WebGLShader object to a WebGLProgram object.

bindAttribLocation

Binds a generic vertex index to a user-defined attribute variable.

bindBuffer

Associates a buffer with a buffer target.

bindFramebuffer

Associates a WebGLFramebuffer object with the gl.FRAMEBUFFER bind target.

bindRenderbuffer

Binds a WebGLRenderbuffer object to be used for rendering.

bindTexture

Binds a named texture object to a target.

blendColor

Specifies the blend color used to calculate source and destination blending.

blendEquation

Sets the equation used to blend RGB and Alpha values of an incoming source fragment with a destination values as stored in the fragment's frame buffer.

blendEquationSeparate

Controls the blending of an incoming source fragment's R, G, B, and A values with a destination R, G, B, and A values as stored in the fragment's WebGLFramebuffer.

blendFunc

Sets the blending factors used to combine source and destination pixels.

blendFuncSeparate

Sets the weighting factors that are used by blendEquationSeparate.

bufferData

Creates a buffer in memory and initializes it with array data. If no array is provided, the contents of the buffer is initialized to 0.

bufferSubData

Used to modify or update some or all of a data store for a bound buffer object.

checkFramebufferStatus

Returns whether the currently bound WebGLFramebuffer is complete. If not complete, returns the reason why.

clear

Sets all pixels in a specific buffer to the same value.

clearColor

Specifies color values to use by the clear method to clear the color buffer.

clearDepth

Clears the depth buffer to a specific value.

clearStencil

Specifies the clear value to be used by the clear method to clear the stencil buffer.

colorMask

Lets you set whether individual colors can be written when drawing or rendering to a framebuffer.

compileShader

Compiles the GLSL shader source into binary data used by the WebGLProgram object.

compressedTexImage2D

Specifies a two-dimensional texture image or cube Map image from compressed image data.

compressedTexSubImage2D

Specifies a two-dimensional texture or cube Map sub-image from compressed image data.

copyTexImage2D

Copies a rectangle of pixels from the current WebGLFramebuffer into a texture image.

copyTexSubImage2D

Replaces a portion of an existing 2D texture image with data from the current framebuffer.

createBuffer

Creates and initializes a WebGLBuffer.

createFramebuffer

Returns a WebGLFramebuffer object.

createProgram

Creates an empty WebGLProgram object to which vector and fragment WebGLShader objects can be bound.

createRenderbuffer

Creates and returns a WebGLRenderbuffer object.

createShader

Returns an empty vertex or fragment shader object based on the type specified.

createTexture

Used to generate a WebGLTexture object to which images can be bound.

cullFace

Sets whether or not front, back, or both facing facets are able to be culled.

deleteBuffer

Delete a specific buffer.

deleteFramebuffer

Deletes a specific WebGLFramebuffer object.

deleteProgram

Flags a specific WebGLProgram object for deletion if currently active.

deleteRenderbuffer

Deletes the specified renderbuffer object.

deleteShader

Deletes a specific shader object.

deleteTexture

Deletes a specific texture object.

depthFunc

Sets a function to use to compare incoming pixel depth to the current depth buffer value.

depthMask

Sets whether or not you can write to the depth buffer.

depthRange

Sets the depth range for normalized coordinates to canvas or viewport depth coordinates.

detachShader

Detach a shader object from a program object.

disable

Turns off specific WebGL capabilities for this context.

disableVertexAttribArray

Turns off a vertex attribute array at a specific index position.

drawArrays

Render geometric primitives from bound and enabled vertex data.

drawArraysInstancedANGLE

Render geometric primitives from bound and enabled instanced array vertex data. Call gl.getExtension("ANGLE_instanced_arrays") to enable ANGLE_instanced_arrays before using this method.

drawElements

Renders geometric primitives indexed by element array data.

drawElementsInstancedANGLE

Renders geometric primitives indexed by instanced array element data. Call gl.getExtension("ANGLE_instanced_arrays") to enable ANGLE_instanced_arrays before using this method.

enable

Turns on specific WebGL capabilities for this context.

enableVertexAttribArray

Turns on a vertex attribute at a specific index position in a vertex attribute array.

framebufferRenderbuffer

Attaches a WebGLRenderbuffer object as a logical buffer to the currently bound WebGLFramebuffer object.

framebufferTexture2D

Attaches a texture to a WebGLFramebuffer object.

frontFace

Sets whether or not polygons are considered front-facing based on their winding direction.

generateMipmap

Creates a set of textures for a WebGLTexture object with image dimensions from the original size of the image down to a 1x1 image.

getActiveAttrib

Returns an WebGLActiveInfo object containing the size, type, and name of a vertex attribute at a specific index position in a program object.

getActiveUniform

Returns an WebGLActiveInfo object containing the size, type, and name of a uniform attribute at a specific index position in a program object.

getAttachedShaders

Returns a list of WebGLShaders bound to a WebGLProgram.

getAttribLocation

Returns an index to the location in a program of a named attribute variable.

getBufferParameter

Returns the type of a parameter for a given buffer.

getContextAttributes

Returns an object that describes the attributes set on a context when it was created.

getError

Returns a value for the WebGL error flag and clears the flag.

getExtension

Enables a passed extension, otherwise returns null.

getFramebufferAttachmentParameter

Gets a parameter value for a given target and attachment.

getParameter

Returns the natural type value for a constant parameter.

getProgramInfoLog

Returns information about the last error that occurred during the failed linking or validation of a WebGL program object.

getProgramParameter

Returns the value of the program parameter that corresponds to a supplied pname for a given program, or null if an error occurs.

getRenderbufferParameter

Returns a renderbuffer parameter from the currently bound WebGLRenderbuffer object.

getShaderInfoLog

Returns errors which occur when compiling a shader.

getShaderParameter

Returns the value of the parameter associated with pname for a shader object.

getShaderPrecisionFormat

Returns the precision and range of the supplied numeric format for a given shader type.

getShaderSource

Returns source code string associated with a shader object.

getSupportedExtensions

Returns an array of supported extension strings.

getTexParameter

Returns the value for a parameter on an active texture unit.

getUniform

Gets the uniform value for a specific location in a program.

getUniformLocation

Returns a WebGLUniformLocation object for the location of a uniform variable within a WebGLProgram object.

getVertexAttrib

Returns data for a particular characteristic of a vertex attribute at an index in a vertex attribute array.

getVertexAttribOffset

Returns the address of a specified vertex attribute.

isBuffer

Gets state of WebGLBuffer. Returns true if buffer is valid, false otherwise.

isContextLost

Returns whether the WebGL context has been lost.

isEnabled

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

isFramebuffer

Gets state of framebuffer. Returns true if buffer is valid, false otherwise.

isProgram

Gets state of WebGL program object. Returns true if program object is valid, false otherwise.

isRenderbuffer

Gets state of WebGL renderbuffer. Returns true if buffer is valid, false otherwise.

isShader

Gets state of WebGL shader. Returns true if shader is valid, false otherwise.

isTexture

Gets state of WebGL texture. Returns true if texture is valid, false otherwise.

lineWidth

Not supported in Internet Explorer 11. Sets the width of lines in WebGL.

linkProgram

Links an attached vertex shader and an attached fragment shader to a program so it can be used by the graphics processing unit (GPU).

pixelStorei

Sets pixel storage modes for readPixels and unpacking of textures with texImage2D and texSubImage2D .

polygonOffset

Sets the implementation-specific units and scale factor used to calculate fragment depth values.

readPixels

Reads pixel data into an ArrayBufferView object from a rectangular area in the color buffer of the active frame buffer.

renderbufferStorage

Creates or replaces the data store for the currently bound WebGLRenderbuffer object.

sampleCoverage

Sets multi-sample coverage parameters for antialiasing.

scissor

Sets the dimensions of the scissor box.

shaderSource

Sets and replaces shader source code in a shader object.

stencilFunc

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

stencilFuncSeparate

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

stencilMask

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

stencilMaskSeparate

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

stencilOp

Sets front and back stencil test actions.

stencilOpSeparate

Sets front and/or back stencil test actions.

texImage2D

Loads the supplied pixel data into a texture.

texParameterf

Sets texture parameters for the current texture unit.

texParameteri

Sets texture parameters for the current texture unit.

texSubImage2D

Replaces a portion of an existing 2D texture image with all of another image.

uniform1f

Assigns a floating point value to a uniform variable for the current program object.

uniform1fv

Assigns a floating point vector array to a uniform vector variable for the current program object.

uniform1i

Assigns an integer value to a uniform variable for the current program object.

uniform1iv

Assigns an integer vector array value to a uniform variable for the current program object.

uniform2f

Assigns two dimensional floating point values to a uniform variable for the current program object.

uniform2fv

Assigns two dimensional floating point vector array to a uniform variable for the current program object.

uniform2i

Assigns two dimensional integer value to a uniform variable for the current program object.

uniform2iv

Assigns two dimensional integer vector array values to a uniform variable for the current program object.

uniform3f

Assigns three dimensional floating point values to a uniform variable for the current program object.

uniform3fv

Assigns three dimensional floating point vector array values to a uniform variable for the current program object.

uniform3i

Assigns three dimensional integer values to a uniform variable for the current program object.

uniform3iv

Assigns three dimensional integer vector array values to a uniform variable for the current program object.

uniform4f

Assigns four dimensional floating point values to a uniform variable for the current program object.

uniform4fv

Assigns four dimensional floating point vector array values to a uniform variable for the current program object.

uniform4i

Assigns four dimensional integer value to a uniform variable for the current program object.

uniform4iv

Assigns four dimensional integer vector array values to a uniform variable for the current program object.

uniformMatrix2fv

Sets values for a 2x2 floating point vector matrix into a uniform location as a matrix or a matrix array.

uniformMatrix3fv

Sets values for a 3x3 floating point vector matrix into a uniform location as a matrix or a matrix array.

uniformMatrix4fv

Sets values for a 4x4 floating point vector matrix into a uniform location as a matrix or a matrix array.

useProgram

Set the program object to use for rendering.

validateProgram

Returns whether a given program can run in the current WebGL state.

vertexAttribDivisorANGLE

Sets the advance rate for vertex attributes when rendering multiple instances using drawArraysInstancedANGLE or drawElementsInstancedANGLE. This method is enabled using ANGLE_instanced_arrays.

vertexAttribPointer

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

viewport

Represents a rectangular viewable area that contains the rendering results of the drawing buffer.

 

 

 

Show:
© 2014 Microsoft