GLGE
GLGE copied to clipboard
Add CORS support for textures
I ran into this problem when trying to load a model from another domain. The .dae came in fine, but a security error happened when trying to render the texture. Last year, CORS for webgl textures was briefly disabled because it actually was a security risk, but now Chrome and FF currently support the crossorigin
attribute on Image
to circumvent the problem.
I was able to bypass this issue by modifying GLGE.Texture.prototype.setSrc
as following:
// ... snip ...
this.image=new Image();
this.image.crossOrigin = "anonymous"; // Allow cross-domain resource sharing for image
// ..rest of code ...
I'm not sure if this is by design or an oversight; however, any clarification would greatly be appreciated. Thanks!