Fbo

Fbo

new Fbo(gl, width, height, optsopt)

Parameters:
Name Type Attributes Description
gl WebGLRenderingContext then webgl context this Fbo belongs to
width uint initial width of the fbo, the size can be later changed using Fbo#resize()
height uint initial height of the fbo, the size can be later changed using Fbo#resize()
opts Object <optional>
Properties
Name Type Attributes Default Description
depth boolean <optional>
false if true, a depth renderbuffer is attached
stencil boolean <optional>
false if true, a stencil renderbuffer is attached
type GLenum | Array.<GLenum> <optional>
GL_UNSIGNED_BYTE the pixel type of the Fbo, can be gl.UNSIGNED_BYTE, gl.FLOAT, half.HALF_FLOAT_OES etc. you can also provide an array of types used as cascaded fallbacks
format GLenum <optional>
GL_RGB the internal pixel format.
Source:

Methods

bind()

Bind the Fbo and set gl viewport to it's size
Source:

bindColor(location, unit)

Bind the color texture of this Fbo to a sampler2D location and a unit The related program must be in use.
Parameters:
Name Type Description
location WebGLUniformLocation the program's sampler to bind the textue to
unit the texture unit to use
Source:

clear()

Clear all buffer of the Fbo. The Fbo must be explicitly bound before calling this method
Source:

dispose()

Delete all webgl objects related to this Fbo (fbo, color attachment and depth/stencil renderbuffer )
Source:

getActualType()

return the actual pixel type of the underlying color texture (UNSIGNED_BYTE, FLOAT, HALF_FLOAT_EOS etc) after possibles types has been tested
Source:

isValid()

Check if the Fbo is valid, The Fbo must be explicitely bound before calling this method
Source:

resize(w, h)

Resize FBO attachments
Parameters:
Name Type Description
w uint new width
h uint new height
Source: