new WebGLRenderTarget(helper, opt_size)
Name | Type | Description |
---|---|---|
helper |
module:ol/webgl/Helper~WebGLHelper |
WebGL helper; mandatory. |
size |
Array.<number> |
Expected size of the render target texture; note: this can be changed later on. |
Methods
-
clearCachedData()
webgl/RenderTarget.js, line 93 -
This will cause following calls to
#readAll
or#readPixel
to download the content of the render target into memory, which is an expensive operation. This content will be kept in cache but should be cleared after each new render. -
getSize(){Array.<number>}
webgl/RenderTarget.js, line 83 -
Returns the size of the render target texture
Returns:
Size of the render target texture
-
readAll(){Uint8Array}
webgl/RenderTarget.js, line 103 -
Returns the full content of the frame buffer as a series of r, g, b, a components in the 0-255 range (unsigned byte).
Returns:
Integer array of color values
-
readPixel(x, y){Uint8Array}
webgl/RenderTarget.js, line 124 -
Reads one pixel of the frame buffer as an array of r, g, b, a components in the 0-255 range (unsigned byte). If x and/or y are outside of existing data, an array filled with 0 is returned.
Name Type Description x
number Pixel coordinate
y
number Pixel coordinate
Returns:
Integer array with one color value (4 components)
-
setSize(size)
webgl/RenderTarget.js, line 69 -
Changes the size of the render target texture. Note: will do nothing if the size is already the same.
Name Type Description size
Array.<number> Expected size of the render target texture