createFrameBuffer()
ts
function createFrameBuffer(gl, options?): FrameBuffer;Defined in: createFrameBuffer.js:63
Creates a render target, or a pair (read and write) that swap() flips for ping-pong effects.
type: gl.FLOAT or gl.HALF_FLOAT makes a float target; the internal format and the extension needed to render to it are handled. Throws if the framebuffer is incomplete, naming the reason.
Parameters
| Parameter | Type | Description |
|---|---|---|
gl | WebGL2RenderingContext | The WebGL2 context. |
options? | FrameBufferOptions | See FrameBufferOptions. |
Returns
Example
ts
const feedback = createFrameBuffer(gl, { width: 512, height: 512, type: gl.HALF_FLOAT });
gl.bindFramebuffer(gl.FRAMEBUFFER, feedback.write.fb);
step.setUniforms({ u_previous: feedback.read });
step.render({ width: 512, height: 512 });
gl.bindFramebuffer(gl.FRAMEBUFFER, null);
feedback.swap();