Sign in to follow this  
fsrojas

Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext'

Recommended Posts

Hi Guys,

 

I recently using the last version of PIXI.js (1.5.1) and we are dealing with some problems with particular texture (that texture is in another host).

 

Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': The cross-origin image at XXXXXX may not be loaded.

 

To load the texture i'm using the asset loader and setting the crossorigin property by true.

 

    // assetsToInitloader has the url to the texture

    var preloader = new PIXI.AssetLoader(assetsToInitloader);
    preloader.onComplete = onAssetsInitloaded;
    preloader.crossorigin = true;
    preloader.load();

 

The same code is working fine on Safari, and having problems on Firefox and Chrome.

 

Thanks in advance,

Cheers!

Share this post


Link to post
Share on other sites

I've bumped into this problem using the 1.6.1 version of pixi. I'm using:

 

base_image.crossOrigin = "Anonymous"

 

...doesn't help.

 

Edit:

 

I actually have a different error.

 

"Uncaught SecurityError: Failed to execute 'texImage2D' on 'WebGLRenderingContext': Tainted canvases may not be loaded."

Share this post


Link to post
Share on other sites

This is not an error with Phaser.    This is an issue of how your are running your website and browser security.    You have to run your site from a webserver so the domain name of the page and domain name of the file are the same.   You don't have all the info I need in the post so here is a common example....  I run my site by going to my filesystem and click on the index.html file.   I then open in the browser with a patch like file:///C:/phaserwebsites/test01/index.html.   So the domain is a file path.  Then when your browser tries to go to the img file and load it into your html page it cannot because the domain changes to another file path which is essentially a different domain.    This can also happen if you are running your site from Visual studio or another ide and it runs it on localhost:xxxx port. 

Here is the summary of how you solve it on windows.   (sorry mac users Im a cheapskate so I like windows machines, but the principle is still the same if you can translate to MAC-anese)  :-)  

1. Insalled IIS

2. created a folder and put my website in it

3.Setup a site on IIS using that folder I just created as the stie folder and bound the url phasertest.com to the site in IIS site settings.  

4.In my host file I pointed 127.0.0.1 to phasertest.com

5. Now in my browser I can just type in phasertest.com and the host file will redirect it to localhost which directs the request to IIS which has that site running from that folder.   

If that doesn't make sense then you will need learn about running web servers locally.  Explaining that would be way to much for a simple post.  

Hope that helps!

Share this post


Link to post
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...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.