Add CORS Support for Collada Loader Textures

If I load my Collada file from a cross origin location, such as a Web Service, the Collada file comes down but the textures referenced in the Collada file produce the following error:

Uncaught SecurityError: Failed to execute ‘texImage2D’ on ‘WebGLRenderingContext’: The cross-origin image at https://mywebservice.net/blob/Texture_0.png may not be loaded.

In fact, the Collada file briefly loads before disappearing and showing looping through the aforementioned error in the console

I tried loader.setCrossOrigin(”); but it doesn’t support this function. Can we add CORS support to the Collada loader so it can pull in the textures? The actual textures (image files) are showing as a GET 200 so they must be getting pulled in, but just not being allowed by three.js.

Here is my stack post if it helps to view current code and Update 1 referencing the setCrossOrigin function not working: http://stackoverflow.com/questions/32469104/three-js-cross-origin-error-loading-related-collada-file-texture

Author: Fantashit

1 thought on “Add CORS Support for Collada Loader Textures

  1. ColladaLoader2 has now a public method .setCrossOrigin() that solves this issue. Try to use the new loader and open an issue if you think a feature is missing.

Comments are closed.