Function createSurface
-
createSurface(
engine: EngineContext,
canvas: RenderCanvas,
options?: SurfaceOptions,
): SurfaceContextParameters
- engine: EngineContext
- canvas: RenderCanvas
Optionaloptions: SurfaceOptions
Returns SurfaceContext
Optionaloptions: SurfaceOptions
Create an auxiliary rendering surface bound to an existing engine. The surface configures its own
GPUCanvasContextagainstengine._deviceand is appended toengine.surfaces. GPU resources (textures, buffers, pipelines) are shared across all surfaces of the same engine because they're device-scoped — render to multiple canvases by creating additional surfaces and binding scenes / renderers to each.The engine's own primary surface (
engine.surfaces[0] === engine) is created automatically bycreateEngine(canvas); usecreateSurfaceonly for additional canvases beyond that one.Accepts either a DOM canvas (main thread) or an
OffscreenCanvas(e.g. transferred to a Web Worker viatransferControlToOffscreen()).