WebGLBackend
Defined in: webgl/webgl-backend.ts:19
A renderer for a Scene, implemented per target (WebGL / Canvas / SVG).
Implements
Section titled “Implements”Properties
Section titled “Properties”stylesNeedDrawables
Section titled “stylesNeedDrawables”
readonlystylesNeedDrawables: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.
Implementation of
Section titled “Implementation of”supportsPassThrough
Section titled “supportsPassThrough”
readonlysupportsPassThrough:true=true
Defined in: webgl/webgl-backend.ts:20
True if this backend supports pass-through (canvas/webgl yes, svg no).
Implementation of
Section titled “Implementation of”Methods
Section titled “Methods”appendToLayer()
Section titled “appendToLayer()”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.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”destroy()
Section titled “destroy()”destroy():
void
Defined in: webgl/webgl-backend.ts:386
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”drawPassThrough()
Section titled “drawPassThrough()”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).
Parameters
Section titled “Parameters”string
"replace-first" | "replace-rest" | "append"
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”readPixel()
Section titled “readPixel()”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.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”number[]
readScreenPixel()
Section titled “readScreenPixel()”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.
Parameters
Section titled “Parameters”number
number
Returns
Section titled “Returns”number[]
removeInstancedLayer()
Section titled “removeInstancedLayer()”removeInstancedLayer(
name):void
Defined in: webgl/webgl-backend.ts:208
Remove an instanced primitive layer by name.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”removePassThroughLayer()
Section titled “removePassThroughLayer()”removePassThroughLayer(
name):void
Defined in: webgl/webgl-backend.ts:165
Remove a pass-through layer.
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”Backend.removePassThroughLayer
render()
Section titled “render()”render():
void
Defined in: webgl/webgl-backend.ts:273
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”resize()
Section titled “resize()”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.
Parameters
Section titled “Parameters”number
height
Section titled “height”number
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”setGlobeMode()
Section titled “setGlobeMode()”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.
Parameters
Section titled “Parameters”boolean
number = 2048
number = 1024
Returns
Section titled “Returns”void
setGlobeRotation()
Section titled “setGlobeRotation()”setGlobeRotation(
m):void
Defined in: webgl/webgl-backend.ts:271
Update the globe rotation (mat3, column-major) and repaint. No re-bake.
Parameters
Section titled “Parameters”Float32Array
Returns
Section titled “Returns”void
setInstancedLayer()
Section titled “setInstancedLayer()”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).
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”setLayers()
Section titled “setLayers()”setLayers(
newLayers):void
Defined in: webgl/webgl-backend.ts:70
Parameters
Section titled “Parameters”newLayers
Section titled “newLayers”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”setPassThroughLayer()
Section titled “setPassThroughLayer()”setPassThroughLayer(
layer):void
Defined in: webgl/webgl-backend.ts:159
Register/replace a pass-through layer (no buffers). Backends opt in.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”setTransform()
Section titled “setTransform()”setTransform(
t):void
Defined in: webgl/webgl-backend.ts:213
Parameters
Section titled “Parameters”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”snapshotPassThrough()
Section titled “snapshotPassThrough()”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.)
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”toPNG()
Section titled “toPNG()”toPNG():
string
Defined in: webgl/webgl-backend.ts:351
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”toSVG()
Section titled “toSVG()”toSVG():
string
Defined in: webgl/webgl-backend.ts:357
Returns
Section titled “Returns”string
Implementation of
Section titled “Implementation of”updateLayer()
Section titled “updateLayer()”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)).
Parameters
Section titled “Parameters”string
Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”updateLayerStyles()
Section titled “updateLayerStyles()”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).
Parameters
Section titled “Parameters”string
tables
Section titled “tables”drawables?
Section titled “drawables?”Returns
Section titled “Returns”void
Implementation of
Section titled “Implementation of”create()
Section titled “create()”
staticcreate(canvas,opts):Promise<WebGLBackend>
Defined in: webgl/webgl-backend.ts:48
Parameters
Section titled “Parameters”canvas
Section titled “canvas”HTMLCanvasElement
WebGLBackendOptions
Returns
Section titled “Returns”Promise<WebGLBackend>