ImageTexture
Image texture
Helper class storing image as a WebGL texture. Used by shader classes and renderers as wrapper around images providing convenient interfaces.
Constructors
new ImageTexture()
new ImageTexture(
gl
,size
,grayscale
,linear
):ImageTexture
Constructor
Parameters
• gl: WebGL2RenderingContext
Context where texture is allocated
• size: Size
= ...
Size of the image
• grayscale: boolean
= false
Whether image is grayscsale or rgb
• linear: boolean
= false
Whether interpolation is linear or nearest
Returns
Properties
buffer
protected
buffer:null
|WebGLTexture
=null
Input image texture
gl
protected
gl:WebGL2RenderingContext
Context where texture is allocated
grayscale
protected
grayscale:boolean
=false
Whether image is grayscsale or rgb
linear
protected
linear:boolean
=false
Whether interpolation is linear or nearest
size
protected
size:Size
Size of the image
Methods
dispose()
dispose():
void
Dispose allocated resources
Returns
void
resize()
resize(
size
):boolean
Resize texture
Parameters
• size: Size
New size of the image
Returns
boolean
True when successfully resized, false otherwise
texture()
texture():
null
|WebGLTexture
Texture instance
Returns
null
| WebGLTexture
Instance of the texture
update()
update(
image
):null
|WebGLTexture
Update texture
Parameters
• image: ImageSource
Image to upload into texture
Returns
null
| WebGLTexture
Updated texture
valid()
valid():
boolean
Whether texture is allocated and valid
Returns
boolean
True if texture is allocated, false otherwise