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

前端 未结 7 1995
情深已故
情深已故 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:24

    https://github.com/mrdoob/three.js/issues/687 refers to an issue on three.js' GitHub, which has good list of workarounds, including a link to a wiki page describing how to run locally. There are also some other workarounds in the thread, including adding the following to your scripts:

    THREE.ImageUtils.crossOrigin = "";
    

    Or, adding CORS headers so that they are specifically allowed.

    Note that most of this information was added from the already existing link to the issue, which the original author of this answer did not include.

提交回复
热议问题