Skip to main content

onCanvasSizeChange()

onCanvasSizeChange: ({ GLctx, computeCtx, videoWidth, videoHeight, canvasWidth, canvasHeight })

Description

onCanvasSizeChange() is called when the canvas changes size. Called with dimensions of video and canvas.

Parameters

ParameterDescription
GLctxThe drawing canvas's WebGLRenderingContext or WebGL2RenderingContext.
computeCtxThe compute canvas's WebGLRenderingContext or WebGL2RenderingContext.
videoWidthThe width of the camera feed, in pixels.
videoHeightThe height of the camera feed, in pixels.
canvasWidthThe width of the GLctx canvas, in pixels.
canvasHeightThe height of the GLctx canvas, in pixels.

Example

XR8.addCameraPipelineModule({
name: 'mycamerapipelinemodule',
onCanvasSizeChange: ({ GLctx, videoWidth, videoHeight, canvasWidth, canvasHeight }) => {
myHandleResize({ GLctx, videoWidth, videoHeight, canvasWidth, canvasHeight })
},
})