Expand Minimize

drawElementsInstancedANGLE method

[This documentation is preliminary and is subject to change.]

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




WebGLRenderingContext.drawElementsInstancedANGLE(mode, count, type, offset, primcount);


mode [in]

Type: Number

Specifies the kind of primitives to render.


Draws a line between a pair of vertices. For example, 12 vertices produce 6 separate lines.


Draws a line to the next by a straight line. For example, 12 vertices produce 11 lines connected end to end.


Similar to gl.LINE_STRIP, but connects the last vertex back to the first. For example, 12 vertices produce 12 straight lines. Not as efficient as gl.LINES, and incurs a conversion cost.


Draws a triangle for each group of three consecutive vertices. For example, 12 vertices create 4 separate triangles.


Creates a strip of triangles where each additional vertex creates an additional triangle once the first three vertices have been drawn. For example, 12 vertices create 10 triangles.


Similar to gl.TRIANGLE_STRIP, but creates a fan shaped output. For example 12 vertices create 10 triangles. May incur a conversion cost.


count [in]

Type: Number

The number of elements to render.


Type: number

The type of elements in the element array buffer. Must be a gl.UNSIGNED_SHORT.

offset [in]

Type: Number

Offset into the element array buffer. Must be a valid multiple of the size of type.

primcount [in]

Type: Number

The number of instances to render. Must be a gl.UNSIGNED_SHORT.

Return value

This method does not return a value.


Instancing is only supported on Microsoft Direct3D 10+ GPUs. It isn't supported on Microsoft Direct3D 9-capable GPUs, commonly found on phones and some tablets.

This method can throw the following errors:

WebGL ErrorDescription
gl.INVALID_ENUMIf mode is not an accepted value.
gl.INVALID_VALUEIf count or primcount, is negative.
  • If the currently bound framebuffer is not framebuffer complete
  • If offset isn't a multiple of the size of type
  • If the currently bound WebGLRenderbuffer is invalid.

The vertex attribute is enabled but no buffer is bound or if first + count goes past the end of the vertex attribute array.

For instanced drawing, there are no enabled vertex attribute arrays that have a divisor of zero and are bound to an active generic attribute value in the draw command program.


See also




© 2014 Microsoft