@mocanvas/editor · interface

RenderBackend

interface RenderBackend

A GPU backend that can draw one engine frame. Implementations: WebGL2 (now), WebGPU (later).


Methods · 5

deleteTexture(id: number): void

Release a texture. Batches still referencing id fall back to solid colour.

dispose(): void
draw(frame: FrameBuffers, camera: CameraState, options: DrawOptions): void

Draw one frame. Batches are bound to the texture named by their texture word (0 = solid colour) and, when they carry a clip rect, scissored to it.

resize(width: number, height: number, dpr: number): void

Resize the drawing buffer. Sizes are CSS pixels; dpr is the device pixel ratio.

uploadTexture(id: number, source: TextureSource, opts?: TextureOptions): void

Create or replace the texture with host id id (must be non-zero; 0 is the built-in solid texture). Shapes reference it through StyleWords.texture.


Properties · 1

readonly kind: "webgl2" | "webgpu"

mocanvas is built by Symbio. Free for non-commercial, non-profit and development use; commercial use needs an agreement. Not affiliated with or endorsed by tldraw.