cross-domain image for three.js (canvas/webGL), proxy? -
i realize may not possible... i've been scouring around , trying out different things no avail, thought might merit post before giving up...
i'm putting app uses three.js (webgl) , give user option input url image on web , use texture 3d object in web app. no problem if not whole cross-domain security issue.
i know there supposed work arounds cors approved images, though don't entirely understand this, it's impression has set on host's end (and users need able pull image anywhere on web , use @ texture) >> i've tried this: https://hacks.mozilla.org/2011/11/using-cors-to-load-webgl-textures-from-cross-domain-images/ ...but didn't work (probably due misunderstanding of constitutes "cors approved" )
i thought maybe doing kind of php proxy might work? tried this: http://benalman.com/code/projects/php-simple-proxy/docs/files/ba-simple-proxy-php.html ...but didn't seem have luck. (it may not have been written work images... getting mime type errors... , when hacked around bit managed rid of error... still no luck)
...hope out there can help!
i found three.js webgl+cors didn't work me when using three.imageutils.loadtexture function.
this code did work me though (note: corsproxy.com same php in nick's answer)
var url = 'http://www.corsproxy.com/yourdomain/yourfolder/yourimage.png'; var image = document.createelement('img'); image.crossorigin = ''; image.src = url; var texture = new three.texture(image); texture.needsupdate = true; material.map = texture;
Comments
Post a Comment