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
Section titled “Constructors”Constructor
Section titled “Constructor”new ImageTexture(
gl
,size
,grayscale
,linear
,mipmap
):ImageTexture
Constructor
Parameters
Section titled “Parameters”WebGL2RenderingContext
Context where texture is allocated
Size
= ...
Size of the image
grayscale
Section titled “grayscale”boolean
= false
Whether image is grayscsale or rgb
linear
Section titled “linear”boolean
= false
Whether interpolation is linear or nearest
mipmap
Section titled “mipmap”boolean
= false
Returns
Section titled “Returns”ImageTexture
Properties
Section titled “Properties”buffer
Section titled “buffer”
protected
buffer:null
|WebGLTexture
=null
Input image texture
protected
gl:WebGL2RenderingContext
Context where texture is allocated
grayscale
Section titled “grayscale”
protected
grayscale:boolean
=false
Whether image is grayscsale or rgb
levels
Section titled “levels”
protected
levels:number
=0
Number of mipmap levels
linear
Section titled “linear”
protected
linear:boolean
=false
Whether interpolation is linear or nearest
mipmap
Section titled “mipmap”
protected
mipmap:boolean
=false
protected
size:Size
Size of the image
Methods
Section titled “Methods”dispose()
Section titled “dispose()”dispose():
void
Dispose allocated resources
Returns
Section titled “Returns”void
genLevels()
Section titled “genLevels()”genLevels():
boolean
Generate mipmap levels if enabled
Returns
Section titled “Returns”boolean
isGrayscale()
Section titled “isGrayscale()”isGrayscale():
boolean
Whether texture is grayscale
Returns
Section titled “Returns”boolean
True if texture is grayscale
levelCount()
Section titled “levelCount()”levelCount():
number
Number of mipmap levels
Returns
Section titled “Returns”number
levelSize()
Section titled “levelSize()”levelSize(
level
):Size
Size of the mipmap level
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”resize()
Section titled “resize()”resize(
size
):boolean
Resize texture
Parameters
Section titled “Parameters”New size of the image
Returns
Section titled “Returns”boolean
True when successfully resized, false otherwise
texture()
Section titled “texture()”texture():
null
|WebGLTexture
Texture instance
Returns
Section titled “Returns”null
| WebGLTexture
Instance of the texture
textureSize()
Section titled “textureSize()”textureSize():
Size
Texture size
Returns
Section titled “Returns”Size of the texture
update()
Section titled “update()”update(
image
):null
|WebGLTexture
Update texture
Parameters
Section titled “Parameters”ImageSource
Image to upload into texture
Returns
Section titled “Returns”null
| WebGLTexture
Updated texture
valid()
Section titled “valid()”valid():
boolean
Whether texture is allocated and valid
Returns
Section titled “Returns”boolean
True if texture is allocated, false otherwise