Skip to main content

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

NameTypeDefault valueDescription
glWebGL2RenderingContextundefinedContext where texture is allocated
sizeSizeundefinedSize of the image
grayscalebooleanfalse-
linearbooleanfalse-

Properties

buffer

Protected buffer: null | WebGLTexture = null

Input image texture


gl

Protected gl: WebGL2RenderingContext

Context where texture is allocated


grayscale

Protected grayscale: boolean = false


linear

Protected linear: boolean = false


size

Protected size: Size

Size of the image

Methods

dispose

dispose(): void

Dispose allocated resources

Returns

void


resize

resize(size): boolean

Resize texture

Parameters

NameTypeDescription
sizeSizeNew 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

NameTypeDescription
imageImageSourceImage 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