Class: WebGLPointsRenderer
Defined in: webgl/WebGLPointsRenderer.ts:57
WebGL renderer for two-dimensional point clouds
Manages GPU buffers, shaders, a marker atlas texture, and per-object
uniform block data. Points are rendered as gl.POINTS using per-vertex
attributes (x, y, size, color, marker, object index).
All objects share one set of buffers, each object owning the slice that starts at its buffer offset. Synchronizing compares the current model state against the state each slice was last loaded from, and re-uploads only what changed.
Extends
WebGLRendererBase<Points,PointsData,RenderedPoints>
Constructors
Constructor
new WebGLPointsRenderer(
context,onInitialized,onError,options?):WebGLPointsRenderer
Defined in: webgl/WebGLPointsRenderer.ts:114
Creates the shader program, uniform locations, GPU buffers, and vertex array object for point rendering
The marker atlas texture is loaded asynchronously, so the renderer must not
be drawn before onInitialized has been called; onError is called instead
if loading it failed or was aborted.
Parameters
context
The WebGL context to use for rendering
onInitialized
() => void
Called once the marker atlas texture has been loaded
onError
(error) => void
Called if the marker atlas texture could not be loaded
options?
Optional abort signal and render options
renderOptions?
signal?
AbortSignal
Returns
WebGLPointsRenderer
Overrides
WebGLRendererBase< Points, PointsData, RenderedPoints >.constructor
Properties
context
readonlycontext:WebGLContext
Defined in: webgl/WebGLRendererBase.ts:40
Inherited from
WebGLRendererBase.context
renderedObjects
protectedrenderedObjects:RenderedPoints[] =[]
Defined in: webgl/WebGLRendererBase.ts:42
Inherited from
WebGLRendererBase.renderedObjects
viewport
protectedviewport:Rect
Defined in: webgl/WebGLRendererBase.ts:41
Inherited from
WebGLRendererBase.viewport
Methods
destroy()
destroy():
void
Defined in: webgl/WebGLPointsRenderer.ts:403
Releases the shader program, VAO, marker atlas texture, and all GPU buffers
Returns
void
draw()
draw():
void
Defined in: webgl/WebGLPointsRenderer.ts:339
Issues the WebGL draw call for all synchronized points
Binds the shader program, configures uniforms (transform, viewport,
canvas size, device pixel ratio), binds the marker atlas texture, and
draws all points in a single gl.POINTS call with alpha blending.
Returns
void
Throws
Error if the renderer has not been initialized
getRenderedBounds()
protectedgetRenderedBounds():Rect|null
Defined in: webgl/WebGLRendererBase.ts:277
Gets the bounding box of all rendered objects, in world coordinates
Returns
Rect | null
The bounds, or null if no objects are rendered
Inherited from
WebGLRendererBase.getRenderedBounds
getViewport()
getViewport():
Rect
Defined in: webgl/WebGLRendererBase.ts:68
Gets the current viewport
Returns
Inherited from
WebGLRendererBase.getViewport
loadObjects()
protectedloadObjects(layers,objects,tables,loadObject,loadTable,options?):Promise<ObjectRef<Points,PointsData>[]>
Defined in: webgl/WebGLRendererBase.ts:111
Concurrently loads the data of all objects to be rendered on the given layers
An object assigned to a layer by layer ID is loaded for that layer only, an object assigned per item by a table column is loaded for every layer, with the items on each layer resolved from the table (see _getLayerItemsInfos). The data of an object, and of a table, is loaded once, no matter how many references it is shared by.
The returned references are ordered by layer and then by object. Objects whose data or table failed to load are logged and skipped. Objects without items on a layer are skipped silently, which also covers empty objects and objects whose table is empty - those are legitimate states, not failures.
Parameters
layers
Layer[]
The layers to load objects for
objects
Points[]
The objects (points or shapes) to load
tables
Table[]
The tables that the objects resolve their item layers from
loadObject
(object, options?) => Promise<PointsData>
A function to load the data of an object
loadTable
(table, options?) => Promise<TableData>
A function to load the data of a table
options?
Optional abort signal
signal?
AbortSignal
Returns
Promise<ObjectRef<Points, PointsData>[]>
A promise that resolves to one reference per loaded object and layer
Inherited from
WebGLRendererBase.loadObjects
setRenderOptions()
setRenderOptions(
options):object
Defined in: webgl/WebGLPointsRenderer.ts:235
Sets the render options, and reports what they require to take effect
The global point size factor is a shader uniform, so changing it never requires a resynchronization, only a redraw.
Parameters
options
The options to set for the renderer
Returns
object
Whether the renderer has to be resynchronized and/or redrawn
redraw
redraw:
boolean
resync
resync:
boolean
setViewport()
setViewport(
viewport):boolean
Defined in: webgl/WebGLRendererBase.ts:81
Sets the viewport for the renderer
Does not redraw, the caller is expected to redraw whenever the viewport changed.
Parameters
viewport
The new viewport to set
Returns
boolean
True if the viewport was changed, false otherwise
Inherited from
WebGLRendererBase.setViewport
synchronize()
synchronize(
layers,points,tables,markerMaps,sizeMaps,colorMaps,visibilityMaps,opacityMaps,loadPoints,loadTable,options?):Promise<Rect|null>
Defined in: webgl/WebGLPointsRenderer.ts:271
Synchronizes GPU buffers with the current model state
Loads all points data for the given layers, resolves configuration-driven properties (marker, size, color, visibility, opacity) via the provided maps and table loader, and uploads the results into GPU buffers. Only the properties whose configuration actually changed are resolved again.
Objects beyond the shader's per-object limit are dropped, with a warning.
Parameters
layers
Layer[]
Layers to render
points
Points[]
Points data objects
tables
Table[]
Tables that the points objects resolve their properties from
markerMaps
Project-global marker maps for GroupByConfig resolution
sizeMaps
GroupValueMap<number>[]
Project-global size maps
colorMaps
Project-global color maps
visibilityMaps
GroupValueMap<boolean>[]
Project-global visibility maps
opacityMaps
GroupValueMap<number>[]
Project-global opacity maps
loadPoints
(points, options?) => Promise<PointsData>
Async getter for points data
loadTable
(table, options?) => Promise<TableData>
Async getter for table data
options?
Optional abort signal
signal?
AbortSignal
Returns
Promise<Rect | null>
The bounding box of all rendered points in world coordinates, or
null if nothing is rendered