Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MTLLoader Example Using "this" inside Static Function Call #3539

Closed
tehdiplomat opened this issue Jun 3, 2013 · 1 comment
Closed

MTLLoader Example Using "this" inside Static Function Call #3539

tehdiplomat opened this issue Jun 3, 2013 · 1 comment
Labels

Comments

@tehdiplomat
Copy link

I noticed this issue when trying to load textures from Amazon S3 onto my Serve on EC2.

Inside examples/js/loaders/MTLLoader.js there's a static call at line 356, from MaterialCreature.createMaterial_

params[ 'map' ] = THREE.MTLLoader.loadTexture( this.baseUrl + value );

Inside of loadTexture() there's a reference to this.crossOrigin. Since "this" is a function and not an object, it returns null instead of whatever crossOrigin is set inside the created MTLLoader. This causes an issue where objects that successfully download from CORS aren't redrawn (because the canvas is dirty and the images crossOrigin attribute never gets set properly) and instead spew out "Uncaught Error: SecurityError: DOM Exception 18 " errors in the console.

To work around this locally, I just changed the line 436,

//loader.crossOrgin = this.crossOrigin; 
loader.crossOrigin = 'anonymous';

but I know that's not a permanent fix for the project.

Anyway, thought you guys should know.

@dubejf dubejf mentioned this issue Jun 30, 2015
@dubejf
Copy link
Contributor

dubejf commented Jul 1, 2015

Fixed in #3588 by @gero3. Closing.

@dubejf dubejf closed this as completed Jul 1, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants