Reference freeGeometry()

freeGeometry()

Clears a p5.Geometry object from the graphics processing unit (GPU) memory.

p5.Geometry objects can contain lots of data about their vertices, surface normals, colors, and so on. Complex 3D shapes can use lots of memory which is a limited resource in many GPUs. Calling freeGeometry() can improve performance by freeing a p5.Geometry object’s resources from GPU memory. freeGeometry() works with p5.Geometry objects created with beginGeometry() and endGeometry(), buildGeometry(), and loadModel().

The parameter, geometry, is the p5.Geometry object to be freed.

Note: A p5.Geometry object can still be drawn after its resources are cleared from GPU memory. It may take longer to draw the first time it’s redrawn.

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

Examples

Syntax

freeGeometry(geometry)

Parameters

geometry

3D shape whose resources should be freed.

Notice any errors or typos? Please let us know. Please feel free to edit src/webgl/3d_primitives.js and open a pull request!

Related References