I have been attempting to generate a sun, but every time I test run this code, I encounter an error:
THREE.CanvasRenderer 54 three.min.js:262
102
Uncaught TypeError: Object #<Screen> has no method 'updateMatrixWorld' three.min.js:126
192
Uncaught TypeError: Object #<Screen> has no method 'updateMatrixWorld'
Even though I am using the latest build that I downloaded yesterday (12th Jan 2013).
I would appreciate some guidance on what mistake I might be making!
In addition, I am curious about the distinction between WebGLRenderer and CanvasRenderer.
<script src="vendor/three.js/three.min.js"></script>
<script src="vendor/three.js/Detector.js"></script>
<script src="vendor/three.js/ShaderExtras.js"></script>
<script src="vendor/three.js/Stats.js"></script>
<script>
var scene, renderer, camera, container, W, H;
W = parseInt(document.body.clientWidth);
H = parseInt(document.body.clientHeight);
container = document.createElement('div');
document.body.appendChild(container);
camera = new THREE.PerspectiveCamera(45, W / H, 1, 10000); //field of view, aspect ratio, near and far clipping plane
camera.position.z = 4300;
scene = new THREE.Scene();
//Sun
var sun, sun_geom, sun_mat;
sun_geom = new THREE.SphereGeometry(430, 30, 30); //radius, second and third parameters determine number of triangles to generate
sun_mat = new THREE.MeshNormalMaterial();
sun = new THREE.Mesh(sun_geom, sun_mat);
scene.add(sun);
//renderer
renderer = new THREE.CanvasRenderer();
renderer.setSize(W, H);
container.appendChild(renderer.domElement);
animate();
function animate() {
requestAnimationFrame(animate);
renderer.render(screen, camera);
}
</script>