Skip to content

Documentation / @ripl/3d / createTexture

Function: createTexture() ​

createTexture(source, options?): Texture

Defined in: 3d/src/core/texture.ts:203

Creates a Texture from an image source.

Parameters ​

ParameterTypeDescription
sourceTextureSourceThe image to sample.
options?TextureOptionsSampling and transform options.

Returns ​

Texture

The texture.

Example ​

ts
const canvas = new OffscreenCanvas(64, 64);
// …draw into canvas…
const texture = createTexture(canvas, { repeat: [4, 4] });