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, offset [, indexType])

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

offset

The first index to start drawing from.

indexType <optional>

The data type of the index buffer/


<static> enableAttributes()

Enables a given count of vertex attributes.


<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> 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.