【问题标题】:Safari Mobile - Crashing - Three JS Texture not loading upSafari Mobile - 崩溃 - 三个 JS 纹理未加载
【发布时间】:2014-08-21 18:56:25
【问题描述】:

我正在尝试使用 THREE.js 创建一个球形全景图。它在 Safari Desktop 上运行良好,但在 iPAD 上的 Safari Mobile 上崩溃。它与我加载纹理图像的方式有关。

我尝试过的一些事情

  1. 我正在使用画布渲染器
  2. 尝试加载较小尺寸的图片。
  3. 尝试加载 2 次方纹理图像。
  4. 尝试使用线框材质加载球体 - 成功了!

这是我的代码。 http://pastebin.com/1nwTMHJV

sceneHolder = document.getElementById( 'sceneHolder' );
scene = new THREE.Scene();
camera = new THREE.PerspectiveCamera( 60, SCENE_WIDTH / SCENE_HEIGHT, 1, 10000 );
camera.position.z = 0;
scene.add( camera );

var sphereGeom = new THREE.SphereGeometry( 200, 20, 20 );
//NOTE: If we add {},function(){render()} in the following, it stops working!
var sphereTexture = THREE.ImageUtils.loadTexture('media/vr/testpot.jpg');
mesh = new THREE.Mesh(sphereGeom,new THREE.MeshBasicMaterial({map:sphereTexture,overdraw:true}));
//So that we see the inside of the sphere too!
mesh.doubleSided=true;
scene.add( mesh );

renderer = new THREE.CanvasRenderer();
renderer.setSize(  SCENE_WIDTH, SCENE_HEIGHT );
sceneHolder.appendChild( renderer.domElement );

这是我在 THREE.js 上的帖子 https://github.com/mrdoob/three.js/issues/1529

还有:https://github.com/mrdoob/three.js/issues/1550

谢谢 斯迈拉

【问题讨论】:

  • 我遇到了这个确切的问题,有更新吗?

标签: javascript ipad 3d mobile-safari three.js


【解决方案1】:

我试过了,减少面数可以在 iPad 上运行,但就是丑。

你可以试试:

var sphereGeom = new THREE.SphereGeometry( 200, 10, 10 );

以及渲染时的 Safari 崩溃

renderer.render( scene, camera );

结论: 如果将图像纹理加载到具有太多面的球体,iPad 会崩溃

【讨论】:

    猜你喜欢
    • 2015-08-31
    • 2012-09-15
    • 2017-09-11
    • 2018-04-04
    • 2021-10-08
    • 2015-04-13
    • 2015-06-07
    • 2020-06-10
    • 2022-01-25
    相关资源
    最近更新 更多