Main | API | WebRender | loadTBO

Function

loadTBO(tbo, data, width, height);

Loads all the colour data for an texture into a texture buffer.

Parameters

tbo - [Unsigned Integer]

The id of the texture buffer that is being loaded into.

data - [Uint8Array]/[Uint8ClampedArray]

An array containing all the colour data for the texture. Must be a Uint8Array or a Uint8ClampedArray.

width - [Unsigned Integer]

The width of the texture.

height - [Unsigned Integer]

The height of the texture.

Return

None.

Description

This function will takes all the data of an image taken from a canvas context, and copy it into the texture buffer with the id given. Although WebRender stores the textures as 32-bit colours, the canvas context gives images as 8-bit colour channels, therefore the load function expects the image data as 8-bit colour channels.

Before a texture is loaded, a single pixel black image is stored in the buffer, this is to avoid errors if you try to draw with a texture that has not been loaded yet.

See more detailed information about textures here.

Additional Notes

None.