Reference model()

model()

Draws a p5.Geometry object to the canvas.

The first parameter, model, is the p5.Geometry object to draw. p5.Geometry objects can be built with buildGeometry(). They can also be loaded from a file with loadGeometry().

Note: model() can only be used in WebGL mode.

Multiple instances can be drawn at once with model(geometry, count). On its own, all the instances get drawn to the same spot, but you can use instanceID() inside of a shader to handle each instance. At large counts, this often runs faster than using a for loop.

Examples

Syntax

model(model, [count])

Parameters

model
p5.Geometry: 3D shape to be drawn.
count
Number: number of instances to draw.
Notice any errors or typos? Please let us know. Please feel free to edit src/webgl/loading.js and open a pull request!

Related References