Draws count instances of the next 3D primitive or model using WebGL instanced rendering.
Call a draw method on the returned object to render that primitive count times in a single draw call. Instance-specific transforms and attributes (position, color, etc.) are supplied through a custom shader that reads per-instance data from an instanced attribute buffer.
Examples
Syntax
instances(count)
Parameters
count
Number|p5.StorageBuffer|p5.StorageList: number of instances to draw, or a storage buffer/list whose element count is used. A plain number must be a positive integer.
Returns
p5.InstancesWrapper: an object with methods
sphere, box, plane, ellipsoid, cylinder, cone, torus, triangle, rect, quad, ellipse, arc, model, line, point, bezier, and spline. Call one of these to draw count instances of that primitive.Notice any errors or typos? Please let us know. Please feel free to edit src/webgl/3d_primitives.js and open a pull request!