我试图创建sun,但是当我测试运行此代码时,我收到错误
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'
我也使用最新版本,我昨天(2013年1月12日)下载了。
请帮我找到我做错了什么!
另外,想知道btw WebGLRenderer和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 how many 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>
答案 0 :(得分:2)
在动画功能中
修正了行renderer.render(scene,camera);
我很遗憾发布这样一个愚蠢的问题,愚蠢的错误:|