WebGLRenderingContext: drawArrays() method

Note: This feature is available in Web Workers.

The WebGLRenderingContext.drawArrays() method of the WebGL API renders primitives from array data.

Syntax

js
drawArrays(mode, first, count)

Parameters

mode

A GLenum specifying the type primitive to render. Possible values are:

Note: If mode is POINTS, gl_PointSize may need to be set for drawArrays to render, as its value is unknown if not explicitly written. Only some GPUs set its default as 1.0.

first

A GLint specifying the starting index in the array of vector points.

count

A GLsizei specifying the number of indices to be rendered.

Return value

None (undefined).

Exceptions

Examples

js
gl.drawArrays(gl.POINTS, 0, 8);

Specifications

See also