Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/three.js/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 三、精灵在我的安卓设备上不工作_Javascript_Three.js - Fatal编程技术网

Javascript 三、精灵在我的安卓设备上不工作

Javascript 三、精灵在我的安卓设备上不工作,javascript,three.js,Javascript,Three.js,我正在尝试在我的Android手机上使用THREE.Sprite渲染图像,但图像没有显示。使用Mac上Chrome浏览器的远程调试器,我发现以下错误: Uncaught TypeError: Cannot read property 'vertexAttribDivisorANGLE' of null at THREE.WebGLState.enableAttribute (three.min.js:728) at THREE.SpritePlugin.render (three

我正在尝试在我的Android手机上使用THREE.Sprite渲染图像,但图像没有显示。使用Mac上Chrome浏览器的远程调试器,我发现以下错误:

Uncaught TypeError: Cannot read property 'vertexAttribDivisorANGLE' of null
    at THREE.WebGLState.enableAttribute (three.min.js:728)
    at THREE.SpritePlugin.render (three.min.js:752)
    at THREE.WebGLRenderer.render (three.min.js:663)
    at animate (app.js:1241)
enableAttribute @   three.min.js:728
render  @   three.min.js:752
render  @   three.min.js:663
animate @   app.js:1241
requestAnimationFrame (async)
设备信息:

  • Chrome应用程序版本:56.0.2924.87
  • 操作系统:Android 4.1.2:GT-l8190L构建/JZO54K
我正在使用的代码:

const createSprite = (spriteMap, scaleUnit = 1) => {
  const material = new THREE.SpriteMaterial({ map: spriteMap });
  const sprite = new THREE.Sprite(material);
  const width = material.map.image.width * scaleUnit;
  const height = material.map.image.height * scaleUnit;
  sprite.scale.set(width, height, 1);
  return sprite;
};

// To load my textures:
const loadComponents = (components, callback) => {
  const loadFabricImages = (images, loaded, objs) => {
    if (images.length) {
      fabric.Image.fromURL(images.shift(), (img) => {
        loaded.push(img);
        objs[img._element.getAttribute('src').split('/').pop().split('.').shift()] = img;
        loadFabricImages(images, loaded, objs);
      });
    } else {
      callback(loaded, objs);
    }
  };

  loadFabricImages(components, [], {});
};

loadComponents(['img1.png', 'img2.png'], (textures) => {
    const sprite = createSprite(textures[0], 0.55);
});
它在其他设备和浏览器上运行得非常好

这个问题有什么解决办法吗?提前谢谢