mrdoob/three.js — Issue #1342: More Container
Author: corsaronero
Created: 2012-02-16 14:11:03+00:00
State: open

Hi,
I'm looking for insert two container with containerA one cube and containerB one cube,
the problem is that I see only one cube

EX:

container = document.getElementById('footer');
scene = new THREE.Scene();

camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000);
camera.position.y = 150;
camera.position.z = 300;
scene.add(camera);

// Cube1

var materials = [];
var mat1 = [];
for (var i = 0; i < 6; i++) {

mat1 = new THREE.MeshLambertMaterial({
map: THREE.ImageUtils.loadTexture('textures/moda/sfondo500.jpg'), transparent: false
});
//	materials.push(new THREE.MeshBasicMaterial({ color: Math.random() * 0xffffff }));

}

cube = new THREE.Mesh(new THREE.CubeGeometry(50, 50, 50, 1, 1, 1, mat1), new THREE.MeshFaceMaterial());
cube.position.y = 300;
cube.position.x = -300;

cube.overdraw = true;
scene.add(cube);
renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);

container.appendChild(renderer.domElement);

2)

containerFooter = document.getElementById('container');
scene = new THREE.Scene();

camera = new THREE.PerspectiveCamera(70, window.innerWidth / window.innerHeight, 1, 1000);
camera.position.y = 150;
camera.position.z = 300;
scene.add(camera);

// Cube1

var materials = [];
var mat1 = [];
for (var i = 0; i < 6; i++) {

mat1 = new THREE.MeshLambertMaterial({
map: THREE.ImageUtils.loadTexture('textures/moda/sfondoMoto.jpg'), transparent: false
});
//	materials.push(new THREE.MeshBasicMaterial({ color: Math.random() * 0xffffff }));

}

cube = new THREE.Mesh(new THREE.CubeGeometry(50, 50, 50, 1, 1, 1, mat1), new THREE.MeshFaceMaterial());
cube.position.y = 200;
cube.position.x = -100;

cube.overdraw = true;
scene.add(cube);

renderer = new THREE.CanvasRenderer();
renderer.setSize(window.innerWidth, window.innerHeight);

container.appendChild(renderer.domElement);

how can I do to use two separate containers which contain two cubes?

Thanx ;)