I am writing a glb viewer. It loads and wroks as expected on android and windows. However it does not load on IOS.
When I change the clearcolor of the camera I can see the changes in IOS so the camera seem to load properly. But when I create a simple cube it doesn’t load on IOS.
Is there a way to properly load GLB and hdr on IOS ?
From what I understand I have this issue when I try to load an image, either as an hdr or as a texture. When I don’t load images the script works as expected.
I am sorry for not being precise in my request, but I am confused on the origin of the issue. I tried to display alerts to find the cause. Everything seems to load just fine yet it just displays the clearcolor of the camera.
AI explanation:
The SecurityError: The operation is insecure. message when calling texImage2D in WebGL typically indicates that you’re attempting to use image data in a way that violates browser security policies. This often happens under the following conditions, especially on iOS:
Root Causes
1. Cross-Origin Image Loading
If you load an image from another domain (or even a different port), WebGL considers it “tainted” unless it’s CORS-enabled. This prevents the image from being used in WebGL textures for security reasons.
Fix: Make sure your image source includes the correct CORS headers, and load it like this:
Also, I would like to thank the playcanvas team and moderators. I have been asking many questions lately and you are always quick and helpful in your answers that is truly amazing
Will it be possible to fix the assets loader methods to make it work smoothly on IOS or is my implementation (I host my images in a public huggingfacedataset) unconventional and I should change it ?
This is your hosting related, browsers have cross domain limits, your hosting needs to be set up to allow this, especially the separate domain you load images from. Ideally load images from the same domain as the rest of your website.
I am doing this project for a client’s website. Should all the images be hosted in the client’s website or in my huggingface sapce with the rest of the scripts ?