Skip to content

WebGLBackend

Defined in: webgl/webgl-backend.ts:19

A renderer for a Scene, implemented per target (WebGL / Canvas / SVG).

readonly stylesNeedDrawables: false = false

Defined in: webgl/webgl-backend.ts:106

WebGL renders from the GPU flag/color textures, not the vector view — the drawables arg to updateLayerStyles is only stashed for toSVG export. So the engine may omit it on hot paths (per-frame declutter) to skip an O(n) rebuild.

Backend.stylesNeedDrawables


readonly supportsPassThrough: true = true

Defined in: webgl/webgl-backend.ts:20

True if this backend supports pass-through (canvas/webgl yes, svg no).

Backend.supportsPassThrough

appendToLayer(delta): void

Defined in: webgl/webgl-backend.ts:132

O(new) incremental append: grow the existing GroupRenderer’s geometry buffers (capacity-doubling) and color/flag textures with only the appended tail, instead of rebuilding from full buffers. The engine calls this (not updateLayer) for appends.

The layer is always registered (via setLayers) before any append, so the renderer exists; if it somehow doesn’t, we no-op (nothing to grow from a delta alone). If a new geometry-type pass appears that can’t be grown incrementally (renderer.append returns false), fall back to a full rebuild via updateLayer so the result stays correct.

RenderDelta

void

Backend.appendToLayer


destroy(): void

Defined in: webgl/webgl-backend.ts:386

void

Backend.destroy


drawPassThrough(name, batch, mode): void

Defined in: webgl/webgl-backend.ts:173

Draw a batch into the layer’s accumulation buffer. mode: "replace-first" clears the layer’s buffer first (start of a full repaint), "replace-rest" continues a chunked full repaint without clearing, "append" draws on top (incremental).

string

DrawBatch

"replace-first" | "replace-rest" | "append"

void

Backend.drawPassThrough


readPixel(x, y): number[]

Defined in: webgl/webgl-backend.ts:375

Read a pixel from the offscreen framebuffer (renders first). Flips y for WebGL origin.

number

number

number[]


readScreenPixel(x, y): number[]

Defined in: webgl/webgl-backend.ts:364

Read a pixel from the ONSCREEN canvas default framebuffer after render(). Test aid. Coords are in CSS px; the onscreen buffer is device px, so scale by the buffer ratio.

number

number

number[]


removeInstancedLayer(name): void

Defined in: webgl/webgl-backend.ts:208

Remove an instanced primitive layer by name.

string

void

Backend.removeInstancedLayer


removePassThroughLayer(name): void

Defined in: webgl/webgl-backend.ts:165

Remove a pass-through layer.

string

void

Backend.removePassThroughLayer


render(): void

Defined in: webgl/webgl-backend.ts:273

void

Backend.render


resize(width, height): void

Defined in: webgl/webgl-backend.ts:224

Resize the onscreen canvas drawing buffer (luma owns it via useDevicePixels), recompute the clip matrix at the new size, push the new viewport to every renderer (screen-mode point sizing) and recreate the offscreen export framebuffer. The engine re-pushes layers + renders after. Globe mode reads this.width/height per draw, so it follows automatically.

number

number

void

Backend.resize


setGlobeMode(on, texW?, texH?): void

Defined in: webgl/webgl-backend.ts:257

Enter/leave globe mode. texW/texH = equirect bake size. Idempotent re-entry resizes.

boolean

number = 2048

number = 1024

void


setGlobeRotation(m): void

Defined in: webgl/webgl-backend.ts:271

Update the globe rotation (mat3, column-major) and repaint. No re-bake.

Float32Array

void


setInstancedLayer(layer): void

Defined in: webgl/webgl-backend.ts:192

Register/replace a GPU-instanced primitive layer (the network rendering lane). Optional — only the WebGL backend implements it; other backends omit it, so network instanced rendering is WebGL-only (small-N / export go through the PathContext emitter).

InstancedLayer

void

Backend.setInstancedLayer


setLayers(newLayers): void

Defined in: webgl/webgl-backend.ts:70

RenderLayer[]

void

Backend.setLayers


setPassThroughLayer(layer): void

Defined in: webgl/webgl-backend.ts:159

Register/replace a pass-through layer (no buffers). Backends opt in.

PassThroughLayer

void

Backend.setPassThroughLayer


setTransform(t): void

Defined in: webgl/webgl-backend.ts:213

ViewTransform

void

Backend.setTransform


snapshotPassThrough(): void

Defined in: webgl/webgl-backend.ts:190

No-op for WebGL: the accumulation FBO persists across gestures and PassThroughGL.fboTransform already records the reference transform (set on the last clear), so the composite blit can offset it during a pan with no extra snapshot. (The canvas backend, by contrast, must copy the canvas here because it has no retained FBO.)

void

Backend.snapshotPassThrough


toPNG(): string

Defined in: webgl/webgl-backend.ts:351

string

Backend.toPNG


toSVG(): string

Defined in: webgl/webgl-backend.ts:357

string

Backend.toSVG


updateLayer(name, layer): void

Defined in: webgl/webgl-backend.ts:93

Replace a layer’s geometry + tables: destroy the old renderer and rebuild from the full buffers. updateLayer deliberately has NO same-count recolor shortcut: equal drawable counts do NOT imply unchanged geometry (the hover overlay re-targets a different drawable at the same count every pointer move). Styles-only changes go through updateLayerStyles; appends through appendToLayer (O(new)).

string

RenderLayer

void

Backend.updateLayer


updateLayerStyles(name, tables, drawables?): void

Defined in: webgl/webgl-backend.ts:111

Styles-only update: rewrite the palette/flags textures, refresh the stored vector view (toSVG reads it), leave geometry buffers untouched. drawables omitted ⇒ keep the previously-stored vector view (export may lag the textures until the next update with it).

string

StyleTables

DrawableVector[]

void

Backend.updateLayerStyles


static create(canvas, opts): Promise<WebGLBackend>

Defined in: webgl/webgl-backend.ts:48

HTMLCanvasElement

WebGLBackendOptions

Promise<WebGLBackend>