Skip to main content

Function: createColormapTexture()

createColormapTexture(device, imageData): Texture

Defined in: create-colormap-texture.ts:16

Upload a decoded colormap sprite to the GPU as a 2D array texture.

The image must be exactly 256 pixels wide; each row becomes one layer of the returned Texture (dimension: "2d-array", format: "rgba8unorm"). Use the result as the colormapTexture prop of the Colormap shader module.

Synchronous — pair with decodeColormapSprite when you have a URL or raw bytes rather than an already-decoded ImageData.

Parameters

device

Device

imageData

ImageData

Returns

Texture

Throws

when imageData.width is not 256.