Draw. TextureInfo

Texture Info - Stores info about each texture

Constructor

new TextureInfo(image, useWebGLopt, wrapopt)

Create a TextureInfo, called automatically by the engine

Parameters:
NameTypeAttributesDefaultDescription
imageHTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap
useWebGLboolean<optional>
true

Should use WebGL if available?

wrapboolean | Array.<number><optional>
false

Should the texture wrap (REPEAT) or clamp (CLAMP_TO_EDGE)? Or the WebGL modes across and down, like [gl.CLAMP_TO_EDGE, gl.MIRRORED_REPEAT], as a glTF sampler gives them

Members

glTexture :WebGLTexture|undefined

Type:
  • WebGLTexture | undefined
Properties
TypeDescription
WebGLTexture | undefined

WebGL texture

image

Properties
TypeDescription
HTMLImageElement | HTMLCanvasElement | OffscreenCanvas | ImageBitmap

image source

size

Properties
TypeDescription
Vector2

size of the image

sizeInverse

Properties
TypeDescription
Vector2

inverse of the size, cached for rendering

wrap :boolean|Array.<number>

Type:
  • boolean | Array.<number>
Properties
TypeDescription
boolean | Array.<number>

true for REPEAT wrap mode, false for CLAMP_TO_EDGE, or the WebGL modes across and down

Methods

createWebGLTexture()

Creates the WebGL texture, updates if already created

destroyWebGLTexture()

Destroys the WebGL texture

hasWebGL() → {boolean}

Check if the texture is webgl enabled

Returns:
Type: 
boolean

setWrap(wrapopt)

Set the wrap mode for this texture

Parameters:
NameTypeAttributesDefaultDescription
wrapboolean | Array.<number><optional>
true

true for REPEAT, false for CLAMP_TO_EDGE, or the WebGL modes across and down