--- title: WebGLRenderingContext.drawArrays() slug: Web/API/WebGLRenderingContext/drawArrays tags: - WebGL translation_of: Web/API/WebGLRenderingContext/drawArrays ---
WebGL API 中的WebGLRenderingContext.drawArrays()
方法用于从向量数组中绘制图元。
void gl.drawArrays(mode, first, count);
mode
无。
mode
不是一个可接受值,将会抛出 gl.INVALID_ENUM
异常。first
或者 count
是负值,会抛出 gl.INVALID_VALUE
异常。gl.CURRENT_PROGRAM
为 {{jsxref("null")}},会抛出 gl.INVALID_OPERATION
异常。gl.drawArrays(gl.POINTS, 0, 8);
Specification | Status | Comment |
---|---|---|
{{SpecName('WebGL', "#5.14.11", "drawArrays")}} | {{Spec2('WebGL')}} | Initial definition. |
{{SpecName('OpenGL ES 2.0', "glDrawArrays.xml", "glDrawArrays")}} | {{Spec2('OpenGL ES 2.0')}} | Man page of the OpenGL API. |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("api.WebGLRenderingContext.drawArrays")}}