Image Texture setup

07 March 2019 10:37
I'm getting something new now :D
b4w.min.js:491 Uncaught DOMException: Failed to execute 'texImage2D' on 'WebGL2RenderingContext': The image element contains cross-origin data, and may not be loaded.
at A (http://localhost:51097/Js/b4w.min.js:491:44)
at Object.h.change_image (http://localhost:51097/Js/b4w.min.js:522:316)
at Function.v.replace_image (http://localhost:51097/Js/b4w.min.js:3258:444)
at Image.my_image.onload (http://localhost:51097/:248:27)
07 March 2019 10:46
is this due to the images being located on blob storage and not in my website directory?
07 March 2019 11:30
found the answer here
"I was already using crossOrigin="anonymous" in my example.

I was able to fix this issue by setting crossOrigin before src attribute.

const img = new Image();
img.crossOrigin = "anonymous";
img.src = url;
img.width = 224;
img.height = 224;"

I then had to install CORS for my project and enable it on the blob storage. ALL WORKS !!!
Please register or log in to leave a reply.