Texture

Texture

Class representing a Texture

Constructor

new Texture(gl, format, internalFormat, type, unit)

Source:
Parameters:
Name Type Description
gl WebGLRenderingContext
format GLenum
internalFormat GLenum
type GLenum
unit GLenum

Methods

activeTexture() → {Texture}

active texture
Source:
Returns:
Type:
Texture

bind() → {Texture}

bind texture
Source:
Returns:
Type:
Texture

delete()

delete the texture
Source:

fromData(width, height, dataArray) → {Texture}

update texture from dataArray
Source:
Parameters:
Name Type Description
width number
height number
dataArray Float32Array | Float64Array
Returns:
Type:
Texture

fromImage(image, width, height)

update data fro texture with image
Source:
Parameters:
Name Type Description
image Image
width number
height number
Returns:
Texture

fromSize(width, height) → {Texture}

update texture with width and height and emptyData
Source:
Parameters:
Name Type Description
width number
height number
Returns:
Type:
Texture

generateMipmap() → {Texture}

generate mipmap for texture
Source:
Returns:
Type:
Texture

getTexture() → {Texture}

get webgl texture
Source:
Returns:
Type:
Texture

isActiveTexture(unit) → {boolean}

confirm texture is active
Source:
Parameters:
Name Type Description
unit GLenum
Returns:
Type:
boolean

setFilter(filter) → {Texture}

https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texParameter https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/getTexParameter https://webglfundamentals.org/webgl/lessons/webgl-3d-textures.html
Source:
Parameters:
Name Type Description
filter GLenum
Returns:
Type:
Texture

setFlip()

flip the texture
Source:

setFormat(format, internalFormat, type)

update format for texture
Source:
Parameters:
Name Type Description
format GLenum
internalFormat GLenum
type Glenum

setMagFilter(filter) → {Texture}

set mag filter to texture
Source:
Parameters:
Name Type Description
filter GLenum
Returns:
Type:
Texture

setMinFilter(filter) → {Texture}

set min filter to texture
Source:
Parameters:
Name Type Description
filter GLenum
Returns:
Type:
Texture

setPixelStore(pname, params)

specify the pixel storage mode
Source:
Parameters:
Name Type Description
pname GLenum
params object

unbind()

unbind texture
Source:
Returns:
Texture

wrap()

set the wrap mode in texture
Source: