@novorender/web_app / initCore3D
Function: initCore3D()
function initCore3D(
deviceProfile,
canvas,
imports,
setRenderContext): (value) => Promise<void>
Create and initialize the core 3D render context.
Parameters
Parameter | Type | Description |
---|---|---|
deviceProfile | DeviceProfile | Details about the device on which we're running. |
canvas | HTMLCanvasElement | The html canvas to render to. |
imports | Core3DImports | Non-js resource imports. |
setRenderContext | (context ) => void | A callback function to call whenever the render context changes. |
Returns
Function
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.
Parameters
Parameter | Type |
---|---|
value | DeviceProfile |
Returns
Promise
<void
>