是否可以使用两个WebGLRenderer
实例,使用两个Canvas
来渲染相同的场景?
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();
在这个小提琴中,当我如上所述时,我只能在给定时间在一个画布上渲染。 http://jsfiddle.net/ehsanziya/sbdogbLw/1/