Is it possible to use two instances of WebGLRenderer
, using two Canvas
s to render the same scene?
var renderer = new THREE.WebGLRenderer({
canvas: canvas1
});
renderer.setSize(100,100);
var renderer2 = new THREE.WebGLRenderer({
canvas: canvas2
});
renderer2.setSize(100,100);
var mesh = new THREE.Mesh(
new THREE.BoxGeometry(100,100,100)
);
var scene = new THREE.Scene();
var camera = new THREE.PerspectiveCamera();
camera.position.z = 500;
scene.add(mesh);
function draw(){
//try commenting the first render out
//it will allow the other renderer to draw
renderer.render(scene,camera);
renderer2.render(scene,camera);
requestAnimationFrame(draw);
}
draw();
In this fiddle, when I do as above, I can only render on one canvas at a given time. http://jsfiddle.net/ehsanziya/sbdogbLw/1/