Class: Framebuffer

og.webgl.Framebuffer

new og.webgl.Framebuffer(handler, width, height)

Class represents framebuffer.
Name Type Description
handler og.webgl.Handler WebGL handler.
width number optional Framebuffer width. Default is handler canvas width.
height number optional Framebuffer height. Default is handler canvas height.

Members

WebGL handler.

texturenumber

Framebuffer texture.

Methods

Activate framebuffer frame to draw.
Returns:
Type Description
og.webgl.Framebuffer Returns Current framebuffer.

bindOutputTexture()

Bind buffer texture.
Deactivate framebuffer frame.
Gets JavaScript image object that framebuffer has drawn.
Returns:
Type Description
Object

isComplete(){boolean}

Returns framebuffer completed.
Returns:
Type Description
boolean
Open dialog window with framebuffer image.

readAllPixels(){Array.<number>}

Reads all pixels(RGBA colors) from framebuffer.
Returns:
Type Description
Array.<number>

readPixel(x, y){Array.<number, number, number, number>}

Gets pixel RBGA color from framebuffer by coordinates.
Name Type Description
x number Normalized x - coordinate.
y number Normalized y - coordinate.
Returns:
Type Description
Array.<number, number, number, number>

setSize(width, height)

Sets framebuffer viewport size.
Name Type Description
width number Framebuffer width.
height number Framebuffer height.