我在app.domain.com上有一個應用程序,我想從image1.domain.com,image2.domain.com等紋理加載一些圖像。THREE.js中的跨域圖像
我是使用此代碼:
var texture = new THREE.Texture();
var image = new Image();
image.crossOrigin = 'anonymous';
image.onload = function() {
texture.image = image;
texture.needsUpdate = true;
texture.minFilter = THREE.LinearFilter;
};
image.src = url;
在我的圖像響應頭我有Access-Control-Allow-Origin:app.domain.com
但我仍然得到這個錯誤
three.js所201606101337:30942拋出:DOMException:未能執行 'texImage2D' 上 'WebGLRenderingContext' :url中的交叉源圖像可能不被加載。
我猜你的意思是 「像** **響應頭」。 –
是的,在響應標題 – Madalinul
在你的問題中改變了你。 –