WebGLRenderer is xeokit's WebGL2 backend for
Viewer. It attaches to a Viewer, renders one
or more View canvases, keeps GPU state synchronized with Scene and View
changes, and provides picking, snapping, context restoration, memory
diagnostics, and shader diagnostics.
WebGL is the broadly available renderer backend. In most applications, create
a Scene, create a Viewer for that Scene, then create a WebGLRenderer with the
Viewer. The renderer starts observing Scene and View changes as soon as it is
attached.
If you prefer to attach later, construct the renderer without a Viewer and
call WebGLRenderer.attachViewer when the Viewer is ready.
Render And Memory Configuration
Most applications do not need to set WebGL memory configuration. The defaults
are intended to be a reasonable starting point for ordinary model viewing.
The configuration hooks are there for applications with clearer constraints:
very large models, limited GPU memory, unusually many Views, or models whose
geometry needs to be packed into larger or smaller batches.
Think of memoryConfigs as storage tuning. It affects how the renderer sizes
GPU data textures, VBO batches, RTC tiles, and the per-batch limits for
vertices, indices, geometries, meshes, and primitives.
createMemoryConfigs is the usual way to make a complete configuration from
a coarse device class and memory budget. You can also pass direct overrides
when you already know the limits you want:
You can usually just use SceneModel.updateMode and
SceneModel.loadingMode. The renderer has built-in policies for those model
intents.
SceneModel.updateMode describes
whether a model's renderer-facing values are stable ("static"), frequently
changing ("dynamic") or left to the renderer ("auto"). The WebGL renderer
maps that neutral model intent to WebGL-specific storage through
renderer-owned update-mode policies.
Built-in policy selection is keyed by SceneModel.updateMode:
SceneModel updateMode
Built-in WebGL policy
"auto" or unset
Use data-texture triangle storage and stream memory policy.
"static"
Use VBO triangle storage and compact memory policy.
"dynamic"
Use data-texture triangle storage and stream memory policy.
Point meshes use VBO geometry by default. Authored line meshes use
data-texture geometry. Triangle-derived edges, pick and snap passes follow the
triangle policy because they render from the same triangle batch.
On the SceneModel side, the application describes the model without choosing
WebGL storage directly:
constsealed = sceneModel.seal(); if (!sealed.ok) thrownewError(sealed.error);
updateModePolicies is the advanced form of the same idea. Override it only
when the built-in mapping is not a good fit for your models or target
hardware. Policies apply to all models with the matching updateMode, and can
be refined per primitive family:
Update-mode policies can choose between VBO and data-texture geometry storage
where WebGL supports both, and can select compact or stream memory policy for
matching models. They do not replace memoryConfigs: capacity limits such as
maxBatchVertices, maxBatchMeshes, maxViews, and maxTiles remain
renderer-level storage settings.
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
WebGLRenderer is xeokit's WebGL2 backend for Viewer. It attaches to a Viewer, renders one or more View canvases, keeps GPU state synchronized with Scene and View changes, and provides picking, snapping, context restoration, memory diagnostics, and shader diagnostics.
WebGL is the broadly available renderer backend. In most applications, create a Scene, create a Viewer for that Scene, then create a WebGLRenderer with the Viewer. The renderer starts observing Scene and View changes as soon as it is attached.
Basic Usage
If you prefer to attach later, construct the renderer without a Viewer and call WebGLRenderer.attachViewer when the Viewer is ready.
Render And Memory Configuration
Most applications do not need to set WebGL memory configuration. The defaults are intended to be a reasonable starting point for ordinary model viewing.
The configuration hooks are there for applications with clearer constraints: very large models, limited GPU memory, unusually many Views, or models whose geometry needs to be packed into larger or smaller batches.
Think of
memoryConfigsas storage tuning. It affects how the renderer sizes GPU data textures, VBO batches, RTC tiles, and the per-batch limits for vertices, indices, geometries, meshes, and primitives.createMemoryConfigsis the usual way to make a complete configuration from a coarse device class and memory budget. You can also pass direct overrides when you already know the limits you want:Per-Model Update-Mode Policies
You can usually just use
SceneModel.updateModeandSceneModel.loadingMode. The renderer has built-in policies for those model intents.SceneModel.updateMode describes whether a model's renderer-facing values are stable (
"static"), frequently changing ("dynamic") or left to the renderer ("auto"). The WebGL renderer maps that neutral model intent to WebGL-specific storage through renderer-owned update-mode policies.Built-in policy selection is keyed by
SceneModel.updateMode:"auto"or unset"static""dynamic"Point meshes use VBO geometry by default. Authored line meshes use data-texture geometry. Triangle-derived edges, pick and snap passes follow the triangle policy because they render from the same triangle batch.
On the SceneModel side, the application describes the model without choosing WebGL storage directly:
updateModePoliciesis the advanced form of the same idea. Override it only when the built-in mapping is not a good fit for your models or target hardware. Policies apply to all models with the matchingupdateMode, and can be refined per primitive family:Update-mode policies can choose between VBO and data-texture geometry storage where WebGL supports both, and can select compact or stream memory policy for matching models. They do not replace
memoryConfigs: capacity limits such asmaxBatchVertices,maxBatchMeshes,maxViews, andmaxTilesremain renderer-level storage settings.Diagnostics
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.