Reference pixelDensity()

pixelDensity()

Sets the framebuffer's pixel density or returns its current density.

Computer displays are grids of little lights called pixels. A display's pixel density describes how many pixels it packs into an area. Displays with smaller pixels have a higher pixel density and create sharper images.

The parameter, density, is optional. If a number is passed, as in myBuffer.pixelDensity(1), it sets the framebuffer's pixel density. By default, the framebuffer's pixel density will match that of the canvas where it was created. All canvases default to match the display's pixel density.

Calling myBuffer.pixelDensity() without an argument returns its current pixel density.

Examples

Syntax

pixelDensity([density])

Parameters

density

pixel density to set.

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

Related References