API

Function createEngine

  • Create the Babylon Lite engine bound to canvas. Acquires the GPU adapter + device, configures the canvas's WebGPU context, and returns an EngineContext that is also the primary SurfaceContext — i.e. the returned engine is itself the surface for the given canvas. Additional canvases can be attached afterwards via createSurface(engine, otherCanvas, ...); they share device-scoped GPU resources (textures, meshes, pipelines, bind groups) with the engine and with each other.

    Accepts either a DOM canvas (main thread) or an OffscreenCanvas (e.g. transferred to a Web Worker) — see RenderCanvas.

    Parameters

    Returns Promise<EngineContext>