Menu - Top - Home - Donate to Me

H3DU.Texture

Back to documentation index.

H3DU.Texture(name)

Specifies a texture, which can serve as image data applied to the surface of a shape, or even a 2-dimensional array of pixels used for some other purpose, such as a depth map, a height map, a bump map, a specular map, and so on.

For best results, any textures to be used in WebGL should have width and height each equal to a power of 2, such as 2, 4, 8, 16, and 32.

Parameters

Methods

H3DU.Texture#dispose()

Disposes resources used by this texture.

Return Value

This method doesn't return a value. (Type: void)

(static) H3DU.Texture.fromUint8Array(array, width, height)

Creates a texture from a byte array specifying the texture data.

Parameters

Return Value

The new H3DU.Texture object. (Type: H3DU.Texture)

H3DU.Texture#getHeight()

Gets this texture's known height.

Return Value

This texture's height in pixels. Will be 0 if the texture's image data wasn't loaded yet. (Type: number)

H3DU.Texture#getName()

Gets the name of this texture.

Return Value

Return value. (Type: string)

H3DU.Texture#getWidth()

Gets this texture's known width.

Return Value

This texture's width in pixels. Will be 0 if the texture's image data wasn't loaded yet. (Type: number)

(static) H3DU.Texture.loadTexture(info, [textureCache])

Loads a texture by its URL.

Parameters

Return Value

A promise that resolves when the texture is fully loaded. If it resolves, the result will be an H3DU.Texture object. (Type: Promise)

H3DU.Texture#setClamp(clamp)

Deprecated: Use the TextureInfo class's "wrapS" and "wrapT" parameters instead.

Sets the wrapping behavior of texture coordinates that fall out of range when using this texture. This setting will only have an effect on textures whose width and height are both powers of two. For other textures, this setting is ignored and out-of-range texture coordinates are always clamped.

Parameters

Return Value

This object. (Type: H3DU.Texture)

Back to documentation index.