Movatterモバイル変換


[0]ホーム

URL:


  1. Web
  2. Web APIs
  3. ANGLE_instanced_arrays
  4. drawElementsInstancedANGLE()

ANGLE_instanced_arrays: drawElementsInstancedANGLE() method

Baseline Widely available

This feature is well established and works across many devices and browser versions. It’s been available across browsers since ⁨June 2016⁩.

TheANGLE_instanced_arrays.drawElementsInstancedANGLE() method of theWebGL API renders primitives from array data like thegl.drawElements() method. In addition, it can execute multiple instances of a set of elements.

Note:When usingWebGL2, this method is available asgl.drawElementsInstanced() by default.

Syntax

js
drawElementsInstancedANGLE(mode, count, type, offset, primcount)

Parameters

mode

AGLenum specifying the type primitive to render. Possible values are:

  • gl.POINTS: Draws a single dot.
  • gl.LINE_STRIP: Draws a straight line to the next vertex.
  • gl.LINE_LOOP: Draws a straight line to the next vertex, and connects the last vertex back to the first.
  • gl.LINES: Draws a line between a pair of vertices.
  • gl.TRIANGLE_STRIP
  • gl.TRIANGLE_FAN
  • gl.TRIANGLES: Draws a triangle for a group of three vertices.
count

AGLsizei specifying the number of elements to be rendered.

type

AGLenum specifying the type of the values in the element array buffer. Possible values are:

offset

AGLintptr specifying an offset in the element array buffer. Must be a valid multiple of the size of the giventype.

primcount

AGLsizei specifying the number of instances of the set of elements to execute.

Return value

None (undefined).

Exceptions

  • Ifmode is not one of the accepted values, agl.INVALID_ENUM error is thrown.
  • Ifoffset is an invalid multiple of the size of the given type, agl.INVALID_OPERATION error is thrown.
  • Ifcount orprimcount are negative, agl.INVALID_VALUE error is thrown.

Examples

js
const ext = gl.getExtension("ANGLE_instanced_arrays");ext.drawElementsInstancedANGLE(gl.POINTS, 2, gl.UNSIGNED_SHORT, 0, 4);

Specifications

Specification
WebGL ANGLE_instanced_arrays Khronos Ratified Extension Specification

Browser compatibility

See also

Help improve MDN

Learn how to contribute

This page was last modified on byMDN contributors.


[8]ページ先頭

©2009-2025 Movatter.jp