Failed to execute 'texImage2D' on 'WebGL2RenderingContext' Help me!

I want to load a cross-domain image in the PlayCanvas, Who can help me to be grateful.

It works well in the editor mode,But it failed on our server.

Its to do with CORS that you need to set up your server for. Eg app.assets.loadFromUrl() is blocked by CORS policy

Unfortunately I don’t know much about this area but hopefully this points you in the right direction.

From Dynamic Resource Loading, you can add the following code if your server support CORS.

app.loader._handlers['texture'].crossOrigin = true;
1 Like