Class: Texture

Texture()

new Texture()

General-purpose texture.
Properties:
Name Type Description
gl WebGLRenderingContext The WebGL context.
texture WebGLTexture Handle to the texture.
width number Texture width.
height number Texture height.
depth number Texture depth.
binding GLenum Binding point for the texture.
type GLenum Type of data stored in the texture.
format GLenum Layout of texture data.
internalFormat GLenum Internal arrangement of the texture data.
currentUnit number The current texture unit this texture is bound to.
is3D boolean Whether this texture contains 3D data.
flipY boolean Whether the y-axis is flipped for this texture.
premultiplyAlpha boolean Whether alpha should be pre-multiplied when loading this texture.
mipmaps boolean Whether this texture is using mipmap filtering (and thus should have a complete mipmap chain).
appState Object Tracked GL state.
Source:

Methods

data(data) → {Texture}

Set the image data for the texture. An array can be passed to manually set all levels of the mipmap chain. If a single level is passed and mipmap filtering is being used, generateMipmap() will be called to produce the remaining levels. NOTE: the data must fit the currently-allocated storage!
Parameters:
Name Type Description
data HTMLImageElement | ArrayBufferView | Array Image data. If an array is passed, it will be used to set mip map levels.
Source:
Returns:
The Texture object.
Type
Texture

delete() → {Texture}

Delete this texture.
Source:
Returns:
The Texture object.
Type
Texture

resize(width, height, depthopt) → {Texture}

Re-allocate texture storage.
Parameters:
Name Type Attributes Description
width number Image width.
height number Image height.
depth number <optional>
Image depth or number of images. Required when passing 3D or texture array data.
Source:
Returns:
The Texture object.
Type
Texture

restore(imageopt) → {Texture}

Restore texture after context loss.
Parameters:
Name Type Attributes Description
image HTMLElement | ArrayBufferView | Array <optional>
Image data. An array can be passed to manually set all levels of the mipmap chain. If a single level is passed and mipmap filtering is being used, generateMipmap() will be called to produce the remaining levels.
Source:
Returns:
The Texture object.
Type
Texture