Framebuffer2D

Framebuffer2D

Contains color and depth rendering target buffers for WebGL. Essential for render-to-texture implementations.

Constructor

new Framebuffer2D(width, height, useColor, useDepth)

Source:
Parameters:
Name Type Description
width Number width of the framebuffer in pixels
height Number height of the framebuffer in pixels
useColor Boolean wether to create buffer for color data (cannot be changed after creation)
useDepth Boolean wether to create buffer for depth data (cannot be changed after creation)

Methods

init(gl)

Source:
initializes buffers. internal method, this should not be called manually!
Parameters:
Name Type Description
gl WebGLRenderingContext gl context

setActive(gl)

Source:
binds this framebuffer and sets up gl viewport. also initializes and/or updates buffers if necessary.
Parameters:
Name Type Description
gl WebGLRenderingContext

update(gl)

Source:
updates buffers. Automatically called by this.setActive() if needsUpdate == true
Parameters:
Name Type Description
gl WebGLRenderingContext gl context