Namespace: GL

GL

GL forms a bridge to native WebGL. It's used to keep track of certain states. If the method is in here, use it instead of the raw gl calls.

Author:
  • derschmale <http://www.derschmale.com>

Methods


<static> clear( [clearMask])

Clears the current render target.

Parameters:
Name Type Argument Description
clearMask <optional>

One of ClearMask. If omitted, all planes will be cleared.


<static> drawElements(elementType, numIndices [, indexType] [, offset])

Draws elements for the current index buffer bound.

Parameters:
Name Type Argument Description
elementType

One of ElementType.

numIndices

The amount of indices in the index buffer

indexType <optional>

The data type of the index buffer.

offset <optional>

The first index to start drawing from.


<static> drawElementsInstanced(elementType, numIndices, offset, indexType, numInstances)

Draws multiple instances for the current index buffer bound.

Parameters:
Name Type Description
elementType

One of ElementType.

numIndices

The amount of indices in the index buffer

offset

The first index to start drawing from.

indexType

The data type of the index buffer.

numInstances

The amount of instances to draw


<static> enableAttributes()

Enables a given count of vertex attributes.


<static> flushErrors()

Clears any previous errors from the GL context.


<static> getCurrentRenderTarget()

Gets the current render target.


<static> lockColorMask()

Specifies any calls to setColorMask or states defined by material will have no effect until the first call to unlockColorMask


<static> setBlendState()

Sets the blend state.

See:

<static> setClearColor()

Sets the clear color.


<static> setColorMask()

Specifies whether or not to write color. Uses all channels for efficiency (and the current lack of need for anything else).


<static> setCullMode()

Sets the cull mode.


<static> setDepthMask()

Sets the depth mask.


<static> setDepthTest()

Sets the depth test.


<static> setRenderTarget()

Sets the current render target. It's recommended to clear afterwards for certain platforms.


<static> setStencilState()

Sets a new stencil state.

See:

<static> setVertexLayout(layout [, meshInstance])

Assigns a vertex layout for rendering.

Parameters:
Name Type Argument Description
layout

The vertex layout containing the mesh<->shader mapping. Must be called with "null" when manually assigning vertex buffers.

meshInstance <optional>

<static> setViewport(rect)

Sets the viewport to render into.

Parameters:
Name Type Description
rect *

Any object with a width and height property, so it can be a Rect or even a {linkcode FrameBuffer}. If x and y are present, it will use these too.


<static> unlockColorMask()

Specifies any calls to setColorMask or states defined by material will be applied.


<static> updateStencilReferenceValue()

Sets a new stencil reference value for the current stencil state. This prevents resetting an entire state.