Skip to main content

function.initCore3D

API > initCore3D

Function: initCore3D

initCore3D( deviceProfile, canvas, imports, setRenderContext): (value) => Promise\< void >

Create and initialize the core 3D render context.

Parameters

ParameterTypeDescription
deviceProfileDeviceProfileDetails about the device on which we're running.
canvasHTMLCanvasElementThe html canvas to render to.
importsCore3DImportsNon-js resource imports.
setRenderContext(context) => voidA callback function to call whenever the render context changes.

Returns

A method to explicitly set new device profile (from user input or debugging purposes). This is a relatively low-level API that is aimed at advanced developers only. You should call this method once for each view that you wish to render. It will not return a RenderContext immediately, since that object is tied to a WebGLRenderingContext, which can be lost and recreated. Instead it will call your setback function, either when the render context is ready or restored. You can check RenderContext.isContextLost to see if the underlying WebGLRenderingContext is lost or not. Changes to device profile will force a recreation of the entire context and should generally be avoided.

(value): Promise\< void >

Parameters

ParameterType
valueDeviceProfile

Returns

Promise\< void >

Source

@novorender/core3d/init.ts:65

Source

@novorender/core3d/init.ts:20