Cross-origin image load denied with three.js in chrome

前端 未结 7 1991
情深已故
情深已故 2020-12-06 05:05

Trying to add material in THREE.js like this

var materialWall = new materialClass( { color: 0xffffff, map: THREE.ImageUtils.loadTexture( \'image         


        
7条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-06 05:13

    Perfect solution for:

    THREE.js: Cross-origin image load denied

    Just add timestamp to the image url. I don't know the logic behind it, but it works.

    Example:

    var material = new THREE.MeshBasicMaterial({
      map: loader.load(url + "?v=" + (new Date()).toString(), function() {
        animate();
      })
    });
    

提交回复
热议问题