Renderer · function

createImageTexelDecoder

A decoder that reads texels back exactly, over a context of its own.

Explained in Hello world.

function createImageTexelDecoder(): ImageTexelDecoder
import { createImageTexelDecoder } from '@driftengine/core';

In depth

One context for every image it decodes, created on the first call and kept: a WebGL context is a scarce resource — browsers cap them somewhere around sixteen — and one per image is a capture that stops decoding partway through with a context-lost warning.

preserveDrawingBuffer is not set and nothing is ever drawn: the texture is attached to a framebuffer and read, which is the whole pipeline. antialias: false and depth: false because neither is allocated for a path that rasterises nothing.