ColorTexture2D

ColorTexture2D

A texture class to represent a 2D color texture.

Constructor

new ColorTexture2D(spec, callback)

Instantiates a ColorTexture2D object.
Source:
Parameters:
Name Type Description
spec Object The specification arguments.
Name Type Description
image ArrayBuffer | ImageData | HTMLImageElement | HTMLCanvasElement | HTMLVideoElement The HTMLImageElement to buffer.
url string The HTMLImageElement URL to load and buffer.
src Uint8Array | Float32Array The data to buffer.
width number The width of the texture.
height number The height of the texture.
wrap string The wrapping type over both S and T dimension.
wrapS string The wrapping type over the S dimension.
wrapT string The wrapping type over the T dimension.
filter string The min / mag filter used during scaling.
minFilter string The minification filter used during scaling.
magFilter string The magnification filter used during scaling.
mipMap bool Whether or not mip-mapping is enabled.
invertY bool Whether or not invert-y is enabled.
premultiplyAlpha bool Whether or not alpha premultiplying is enabled.
format string The texture pixel format.
type string The texture pixel component type.
callback function The callback to be executed if the data is loaded asynchronously via a URL.

Extends

Methods

bind(location) → {Texture2D}

Binds the texture object to the provided texture unit location.
Inherited From:
Source:
Parameters:
Name Type Default Description
location number 0 The texture unit location index. Defaults to 0.
Returns:
Type:
Texture2D
The texture object, for chaining.

bufferData(data, width, height) → {Texture2D}

Buffer data into the texture.
Inherited From:
Source:
Parameters:
Name Type Description
data Array | ArrayBuffer The data array to buffer.
width number The width of the data.
height number The height of the data.
Returns:
Type:
Texture2D
The texture object, for chaining.

bufferSubData(data, xOffset, yOffset, width, height) → {Texture2D}

Buffer partial data into the texture.
Inherited From:
Source:
Parameters:
Name Type Default Description
data Array | ArrayBuffer The data array to buffer.
xOffset number 0 The x offset at which to buffer.
yOffset number 0 The y offset at which to buffer.
width number The width of the data.
height number The height of the data.
Returns:
Type:
Texture2D
The texture object, for chaining.

resize(width, height) → {Texture2D}

Resize the underlying texture. This clears the texture data.
Inherited From:
Source:
Parameters:
Name Type Description
width number The new width of the texture.
height number The new height of the texture.
Returns:
Type:
Texture2D
The texture object, for chaining.

setParameters(params) → {Texture2D}

Set the texture parameters.
Inherited From:
Source:
Parameters:
Name Type Description
params Object The parameters by name.
Name Type Description
wrap string The wrapping type over both S and T dimension.
wrapS string The wrapping type over the S dimension.
wrapT string The wrapping type over the T dimension.
filter string The min / mag filter used during scaling.
minFilter string The minification filter used during scaling.
magFilter string The magnification filter used during scaling.
Returns:
Type:
Texture2D
The texture object, for chaining.

unbind() → {Texture2D}

Unbinds the texture object.
Inherited From:
Source:
Returns:
Type:
Texture2D
The texture object, for chaining.