Class: ImageTexture
@geenee/armature.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
constructor
• new ImageTexture(gl
, size?
, grayscale?
, linear?
)
Constructor
Parameters
Name | Type | Default value | Description |
---|---|---|---|
gl | WebGL2RenderingContext | undefined | Context where texture is allocated |
size | Size | undefined | Size of the image |
grayscale | boolean | false | - |
linear | boolean | false | - |
Properties
buffer
• Protected
buffer: null
| WebGLTexture
= null
Input image texture
gl
• Protected
gl: WebGL2RenderingContext
grayscale
• Protected
grayscale: boolean
= false
linear
• Protected
linear: boolean
= false
size
• Protected
size: Size
Methods
dispose
▸ dispose(): void
Dispose allocated resources
Returns
void
resize
▸ resize(size
): boolean
Resize texture
Parameters
Name | Type | Description |
---|---|---|
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
): void
Update texture
Parameters
Name | Type | Description |
---|---|---|
image | ImageSource | Image to upload into texture |
Returns
void
valid
▸ valid(): boolean
Whether texture is allocated and valid
Returns
boolean
True if texture is allocated, false otherwise