Function createEngine
-
Parameters
- canvas: RenderCanvas
- options: EngineDeviceOptions
Returns Promise<EngineContext>
-
Create the Babylon Lite engine bound to
canvas. Acquires the GPU adapter + device, configures the canvas's WebGPU context, and returns anEngineContextthat is also the primarySurfaceContext— i.e. the returned engine is itself the surface for the given canvas. Additional canvases can be attached afterwards viacreateSurface(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
- canvas: RenderCanvas
Optionaloptions: EngineOptions
Returns Promise<EngineContext>
Create an engine that takes ownership of a device from
createDevice. A device backs only one engine; if initialization fails before ownership transfers, the caller retains an unclaimed device.