new module:og/webgl/Framebuffer.Framebuffer(handler, options)
Name | Type | Description | ||||||||||||||||||||||||||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
handler |
Handler | WebGL handler. | ||||||||||||||||||||||||||||||||||||
options |
Object |
optional
Framebuffer options:
|
Members
-
handlerHandler
-
WebGL handler.
-
texturesnumber
-
Framebuffer texture.
Methods
-
activate(){Framebuffer}
-
Activate framebuffer frame to draw.
Returns:
Type Description Framebuffer Returns Current framebuffer. -
bindOutputTexture(attachmentIndex)
-
Bind buffer texture.
Name Type Default Description attachmentIndex
Number 0 optional color attachment index. -
deactivate()
-
Deactivate framebuffer frame.
-
getImage(){Object}
-
Gets JavaScript image object that framebuffer has drawn.
Returns:
Type Description Object - -
isComplete(){boolean}
-
Returns framebuffer completed.
Returns:
Type Description boolean - -
openImage()
-
Open dialog window with framebuffer image.
-
readAllPixels(res, attachmentIndex)
-
Reads all pixels(RGBA colors) from framebuffer.
Name Type Default Description res
Uint8Array Result array. attachmentIndex
Number 0 optional color attachment index. -
readPixels(res, nx, ny, w, h, attachmentIndex)
-
Gets pixel RBGA color from framebuffer by coordinates.
Name Type Default Description res
Uint8Array Normalized x - coordinate. nx
number Normalized x - coordinate. ny
number Normalized y - coordinate. w
number 1 optional Normalized width. h
number 1 optional Normalized height. attachmentIndex
Number 0 optional color attachment index. -
setSize(width, height)
-
Sets framebuffer viewport size.
Name Type Description width
number Framebuffer width. height
number Framebuffer height.