I'm trying to render a THREE.js scene having a background image obtained from a different domain.
I was getting a tainted canvas error because the image did not have CORS approval and as a result manipulation of the canvas results in a security error.
After reading this answer, I set the THREE.TextureLoader() to allow cross origin loading:
var loader = new THREE.TextureLoader();
//allow cross origin loading
loader.crossOrigin = '';
var texture = loader.load(
   url_to_image,
   // Function when resource is loaded
   function ( texture ) {
     var backgroundMesh = new THREE.Mesh(
       new THREE.PlaneGeometry(2, 2, 0),
       new THREE.MeshBasicMaterial({
            map: texture
        })
      );
     backgroundMesh.material.depthTest = false;
     backgroundMesh.material.depthWrite = false;
     // create your background scene
     backgroundScene = new THREE.Scene();
     backgroundCamera = new THREE.Camera();
     backgroundScene.add( backgroundCamera );
     backgroundScene.add( backgroundMesh );
   },
   // Function called when download progresses
   function ( xhr ) {},
   // Function called when download errors
   function ( xhr ) {}
);
However, I now get the CORS error: Access to Image at 'url_to_image' from origin 'my_domain' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'my_domain' is therefore not allowed access.
Comments from this answer seem to suggest that some domains do not give permission to use the image in the browser in WebGL, how can I find out if that is the case?
If it's not a problem with the domain I'm pulling the image from, how can I get this to work?