LoginSignup
8
10

More than 5 years have passed since last update.

three.jsでテクスチャ画像をクロスドメイン回避して取得する

Posted at

課題

three.jsでテクスチャ画像を別ドメインのサーバーから取得したいとき。

なにもしないと
"Cross-origin image load denied by Cross-Origin Resource Sharing policy."
のようなクロスドメインのエラーがでる。

解決方法

これでOK。

THREE.ImageUtils.crossOrigin = "*";
var texture = THREE.ImageUtils.loadTexture("http://example.com/hoge.jpg");
8
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
8
10