We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Greetings,
in this piece of code, can we avoid setting d.crossOrigin when we are dealing with a data url ?
THREE.ImageUtils = {crossOrigin: "",loadTexture: function(a, b, c) { var d = new Image, e = new THREE.Texture(d, b); d.onload = function() { e.needsUpdate = !0; c && c(this) }; d.crossOrigin = this.crossOrigin; d.src = a; return e
You can add a check like this:
if( a.substr(0,4) != "data" ) d.crossOrigin = this.crossOrigin;
this does the trick. Otherwise Chrome 17 throws a Cross-origin image load denied by Cross-Origin Resource Sharing policy for a data url.
T.
The text was updated successfully, but these errors were encountered:
Hmm... I think you shouldn't use ImageUtils.loadTexture in that case. Just do this:
var image = document.createElement( 'img' ); image.src = dataurl; var texture = new THREE.Texture( image ); texture.needsUpdate = true;
Sorry, something went wrong.
Works perfectly, thanks!
@mrdoob , thanks for the sample above !
No branches or pull requests
Greetings,
in this piece of code, can we avoid setting d.crossOrigin when we are dealing with a data url ?
You can add a check like this:
this does the trick. Otherwise Chrome 17 throws a Cross-origin image load denied by Cross-Origin Resource Sharing policy for a data url.
T.
The text was updated successfully, but these errors were encountered: