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.

IE11

 

Syntax

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

Parameters

mode [in]

Type: Number

Specifies the kind of primitives to render.

ValueMeaning
gl.LINES

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

gl.LINE_STRIP

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

gl.LINE_LOOP

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.

gl.TRIANGLES

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

gl.TRIANGLE_STRIP

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.

gl.TRIANGLE_FAN

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

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.

Remarks

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.
gl.INVALID_FRAMEBUFFER_OPERATION
  • 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.
gl.INVALID_OPERATION

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

WebGLRenderingContext
ANGLE_instanced_arrays

 

 

Show:
© 2014 Microsoft