Access webcam through getUserMedia in P3D (in javascript mode)

I want to access the webcam to use its image data to do some things in 3d. This has to work in Javascript mode to run it in a webpage.

This is the workflow for P2D (this is tested and works): Create a video element on the webpage. Use getUserMedia to connect the webcam to the video element. Get the canvas and context (2d) via the externals property to draw on to the canvas. Use the context.drawImage method to draw and access the pixel data of the webcam.

The problem: In P3D the context of the canvas is no longer of the type "CanvasRenderingContext2D" but of the type "WebGLRenderingContext". "WebGLRenderingContext" has no method drawImage. So the webcam images can no longer be drawn and the pixel data is inaccessible.

Please help, many thanks.

Sign In or Register to comment.