This module provides a WebGL2 rendering backend for the xeokit
Viewer. It manages GPU-resident
rendering data, issues draw calls, and keeps GPU state synchronised
with Scene and View changes.
Tight Viewer integration — attach via WebGLRenderer.attachViewer(viewer);
the renderer observes Scene + Viewer events and keeps the GPU
state in lockstep automatically.
Full-precision rendering — tile-based modelling matrices +
camera-relative tiles keep GPU positions near the origin even for
real-world-scale models, so double-precision content renders
without z-fighting or shimmer.
Batched + sorted draws — meshes pack into GPU batches sized
to the configured budget; per-frame sorting minimises material /
shader switches.
Multi-canvas rendering — a single renderer drives any number
of Views; each View paints into
its own canvas.
Configurable GPU memory budgeting — pass
MemoryConfigs to attachViewer to size batches /
tiles / atlases against the host's memory envelope.
GPU memory + shader inspection — getMemoryInspector /
getShaderInspector expose deep diagnostics for tooling
panels.
Picking — pick(params) performs GPU readback for
snap-to-vertex / snap-to-edge picks the BVH path can't answer.
WebGL context restoration — on webglcontextlost /
webglcontextrestored, the renderer rebuilds its GPU state
transparently without losing scene data.
Installation
npminstall@xeokit/sdk
Usage
Attach a WebGLRenderer to a Viewer to enable WebGL2-based
storage and rendering of scene data:
The MemoryConfigs interface allows you to configure GPU memory usage for the
WebGLRenderer. This defines a budget that the renderer adheres to when allocating
textures, indices, and vertex buffers.
The easiest way to create memory configurations is with createMemoryConfigs:
The internal namespace exposes internal diagnostics and debugging facilities
used by the WebGLRenderer implementation itself. These APIs provide deep visibility
into GPU-resident resources, shader programs, command submission, and internal
rendering state while the renderer is running.
This namespace is not part of the public API and is intended solely for
xeokit SDK development and debugging. It is not supported for application use
and may change or be removed without notice.
xeokit WebGL Renderer
WebGL2-based rendering backend for xeokit Viewers
Overview
This module provides a WebGL2 rendering backend for the xeokit Viewer. It manages GPU-resident rendering data, issues draw calls, and keeps GPU state synchronised with Scene and View changes.
Shape
Features
WebGLRenderer.attachViewer(viewer); the renderer observes Scene + Viewer events and keeps the GPU state in lockstep automatically.Viewpaints into its own canvas.attachViewerto size batches / tiles / atlases against the host's memory envelope.getMemoryInspector/getShaderInspectorexpose deep diagnostics for tooling panels.pick(params)performs GPU readback for snap-to-vertex / snap-to-edge picks the BVH path can't answer.webglcontextlost/webglcontextrestored, the renderer rebuilds its GPU state transparently without losing scene data.Installation
Usage
Attach a WebGLRenderer to a Viewer to enable WebGL2-based storage and rendering of scene data:
Reading Memory Usage
You can monitor GPU memory usage via the MemoryUsage interface, accessible from WebGLRenderer.getMemoryUsage:
Configuring GPU Memory Limits
The MemoryConfigs interface allows you to configure GPU memory usage for the WebGLRenderer. This defines a budget that the renderer adheres to when allocating textures, indices, and vertex buffers.
The easiest way to create memory configurations is with createMemoryConfigs:
A more manual approach is to directly implement MemoryConfigs:
Internal Diagnostics API
The internal namespace exposes internal diagnostics and debugging facilities used by the WebGLRenderer implementation itself. These APIs provide deep visibility into GPU-resident resources, shader programs, command submission, and internal rendering state while the renderer is running.
This namespace is not part of the public API and is intended solely for xeokit SDK development and debugging. It is not supported for application use and may change or be removed without notice.