Creates a new p5.Framebuffer object with the same WebGL context as the graphics buffer.
p5.Framebuffer objects are separate drawing surfaces that can be used as textures in WebGL mode. They're similar to p5.Graphics objects and generally run much faster when used as textures. Creating a p5.Framebuffer object in the same context as the graphics buffer makes this speedup possible.
The parameter, options, is optional. An object can be passed to configure the p5.Framebuffer object. The available properties are:
format: data format of the texture, eitherUNSIGNED_BYTE,FLOAT, orHALF_FLOAT. Default isUNSIGNED_BYTE.channels: whether to storeRGBorRGBAcolor channels. Default is to match the graphics buffer which isRGBA.depth: whether to include a depth buffer. Default istrue.depthFormat: data format of depth information, eitherUNSIGNED_INTorFLOAT. Default isFLOAT.stencil: whether to include a stencil buffer for masking.depthmust betruefor this feature to work. Defaults to the value ofdepthwhich istrue.antialias: whether to perform anti-aliasing. If set totrue, as in{ antialias: true }, 2 samples will be used by default. The number of samples can also be set, as in{ antialias: 4 }. Default is to match setAttributes() which isfalse(truein Safari).width: width of the p5.Framebuffer object. Default is to always match the graphics buffer width.height: height of the p5.Framebuffer object. Default is to always match the graphics buffer height.density: pixel density of the p5.Framebuffer object. Default is to always match the graphics buffer pixel density.textureFiltering: how to read values from the p5.Framebuffer object. EitherLINEAR(nearby pixels will be interpolated) orNEAREST(no interpolation). Generally, useLINEARwhen using the texture as an image andNEARESTif reading the texture as data. Default isLINEAR.
If the width, height, or density attributes are set, they won't automatically match the graphics buffer and must be changed manually.
Examples
Syntax
createFramebuffer([options])
Parameters
options
Object:
configuration options.
Returns
p5.Framebuffer: new framebuffer.
This page is generated from the comments in src/core/p5.Graphics.js . Please feel free to edit it and submit a pull request!