I am trying to render a <a-camera>
output to a canvas,
i've set up a canvas in my assets:
<canvas id="canvasnd" crossorigin="anonymous"></canvas>
I've got a camera:
<a-entity id="ndcam" camera look-controls position="2 1.6 -1" rotation="0 90
0"></a-entity>
And when i try to render the camera output like this:
var cameraElement = document.querySelector("#ndcam");
var camera = cameraElement.getAttribute("camera");
var sceneEl = this.el;
var renderer = new THREE.WebGLRenderer({
canvas: canvasnd
});
function render() {
renderer.render(sceneEl, camera);
}
render();
I get the camera is not an instance of three.js camera
error.
The code is on the a-scene, hence the sceneEl = this.el;
.
I tried getting the camera.el
, camera.parentNode
, sceneEl.systems.camera
, sceneEl.systems.camera.activeCameraEl
, but i have really no idea how to get a valid three.camera reference.
I tried this, but the event never fires.
Live fiddle here.