Module: texture

Defines the logic for loading and interacting with file texture resources

Exports the has() and get() functions from resource map

Found in Chapter 5, page 204 of the textbook

Example: 5.1 Texture Shaders
Source:

Methods

(static) activate(textureName, textureUnit)

Activate a texture file within the webGL system
Parameters:
Name Type Description
textureName string the path to the image file
textureUnit gl.TEXTUREI the texture unit to be activated, defaults to TEXTURE0
Source:

(static) deactivate()

Deactivate the webGL texture system
Source:

(static) getColorArray(textureName) → {Uint8Array}

Returns the one dimensional array with color information for all pixels
Parameters:
Name Type Description
textureName string the path to the image file
Source:
Returns:
array with color information for all pixels
Type
Uint8Array

(static) load(textureName) → {Promise}

Loads a texture into the resource map so that it can be drawn
Parameters:
Name Type Description
textureName string the path to the image file
Source:
Returns:
promise to process the texture
Type
Promise

(static) unload(textureName)

Remove the reference to the texture allow for garbage collection
Parameters:
Name Type Description
textureName string the path to the image file
Source: