ANGLE_instanced_arrays.drawElementsInstancedANGLE() 方法在 WebGL API renders primitives from array data like the gl.drawElements() method. In addition, it can execute multiple instances of a set of elements.

注意: 当使用 WebGL2 , this method is available as gl.drawElementsInstanced() 在默认情况下。

句法

void ext.drawElementsInstancedANGLE(mode, count, type, offset, primcount);
					

参数

mode
A GLenum 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
GLsizei specifying the number of elements to be rendered.
type
A GLenum specifying the type of the values in the element array buffer. Possible values are:
offset
GLintptr specifying an offset in the element array buffer. Must be a valid multiple of the size of the given type .
primcount
GLsizei specifying the number of instances of the set of elements to execute.

返回值

None.

异常

  • mode is not one of the accepted values, a gl.INVALID_ENUM error is thrown.
  • offset is a invalid multiple of the size of the given type, a gl.INVALID_OPERATION error is thrown.
  • count or primcount are negative, a gl.INVALID_VALUE error is thrown.

范例

var ext = gl.getExtension('ANGLE_instanced_arrays');
ext.drawElementsInstancedANGLE(gl.POINTS, 2, gl.UNSIGNED_SHORT, 0, 4);
					

规范

规范 状态 注释
ANGLE_instanced_arrays
The definition of 'ANGLE_instanced_arrays' in that specification.
推荐 初始定义。

浏览器兼容性

更新 GitHub 上的兼容性数据
桌面 移动
Chrome Edge Firefox Internet Explorer Opera Safari Android webview Chrome for Android Firefox for Android Opera for Android Safari on iOS Samsung Internet
drawElementsInstancedANGLE Chrome 30 Edge 12 Firefox 33 IE 11 Opera 17 Safari 7 WebView Android 4.4 Chrome Android 30 Firefox Android Yes Opera Android 18 Safari iOS Yes Samsung Internet Android 2.0

图例

完整支持

完整支持

另请参阅

元数据

  • 最后修改: