Skip to content

@tmrw-realityos/charmDocs


@tmrw-realityos/charm / createTextureFromImage

Function: createTextureFromImage()

createTextureFromImage(device, image, existingTexture?): WebGPUTexture

Create WebGPU texture from HTML image

Parameters

device: GPUDevice

GPU device

image: HTMLImageElement

Image

existingTexture?: WebGPUTexture

Existing target texture to load data into. If undefined, a new WebGPUTexture instance is returned.

Returns

WebGPUTexture

WebGPU texture in rgba8unorm format

Defined in

packages/charm/src/graphics/WebGPU/WebGPUTextureTools.ts:15