twgl/draw

Drawing related functions

For backward compatibily they are available at both twgl.draw and twgl
itself

See module:twgl for core functions

Methods

(static) drawBufferInfo(gl, bufferInfo, typeopt, countopt, offsetopt)

Calls gl.drawElements or gl.drawArrays, whichever is appropriate

normally you'd call gl.drawElements or gl.drawArrays yourself
but calling this means if you switch from indexed data to non-indexed
data you don't have to remember to update your draw call.

Parameters:
Name Type Attributes Description
gl WebGLRenderingContext

A WebGLRenderingContext

bufferInfo module:twgl.BufferInfo | module:twgl.VertexArrayInfo

A BufferInfo as returned from module:twgl.createBufferInfoFromArrays or
a VertexArrayInfo as returned from module:twgl.createVertexArrayInfo

type enum <optional>

eg (gl.TRIANGLES, gl.LINES, gl.POINTS, gl.TRIANGLE_STRIP, ...). Defaults to gl.TRIANGLES

count number <optional>

An optional count. Defaults to bufferInfo.numElements

offset number <optional>

An optional offset. Defaults to 0.

(static) drawObjectList(objectsToDraw)

Draws a list of objects

Parameters:
Name Type Description
objectsToDraw Array.<DrawObject>

an array of objects to draw.