Jump to content

[SOLVED] CORS problem with DynamicTexture on some servers (tainted canvas)


Vousk-prod.
 Share

Recommended Posts

Hi everyone,

I'm using DynamicTexture in a projet. It works like a charm in our servers,

But now we delivered the project to an other server and we get the following error:

In Chrome console:

babylon.3.0.max.js:9192 Uncaught DOMException: Failed to execute 'texImage2D' on 'WebGL2RenderingContext': Tainted canvases may not be loaded.
    at Engine.updateDynamicTexture (babylon.3.0.max.js:9192:22)
    at DynamicTexture.update (babylon.3.0.max.js:42260:41)

In Firefox console:

SecurityError: The operation is insecure.  babylon.3.0.max.js:9192
    Engine.prototype.updateDynamicTexture babylon.3.0.max.js:9192:13
    DynamicTexture.prototype.update babylon.3.0.max.js:42260:13

In Edge console,

SCRIPT5022: SecurityError
babylon.3.0.max.js (9192,13)

with a link pointing to https://msdn.microsoft.com/query/dev12.query?appId=Dev12IDEF1&l=FR-FR&k=k(VS.WebClient.Help.SCRIPT5022)

 

It looks like the culprit line in BJS is:

this._gl.texImage2D(this._gl.TEXTURE_2D, 0, internalFormat, internalFormat, this._gl.UNSIGNED_BYTE, canvas);

I can't reproduce the bug in the Playground, I can't even reproduce it on my own servers...

Any idea what the problem could be ?

 

Link to comment
Share on other sites

Thank you @adam

But I don't get something:

Our server is configured to deliver crossorigin content. The other server (from where the public html page is served) loads, in that html page, our scripts and images from our server. So we shouldn't have CORS problem.

The other server should also define CORS rules? Or there is something inside the source code (when loading the image used in DynamicTexture) we need to set to avoid tainted canvas?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...