Firefox vs Chrome WebGL differences - disappearing object #343

Closed
01miru opened this Issue Jul 11, 2011 · 4 comments

Projects

None yet

3 participants

@01miru
01miru commented Jul 11, 2011

Hi, I just start with WebGL and I have a problem with rendering textures.
In Chrome, everything looks fine but in Firefox nothing appears. What is the cause?
I have enabled support for WebGL in Firefox
Demos from this site work without a problem.

screen's:

http://dl.dropbox.com/u/4271271/chrome.png
http://dl.dropbox.com/u/4271271/firefox.png

code:

http://dl.dropbox.com/u/4271271/CUBE.js

@chandlerprall
Contributor

Do you have the Firebug extension for Firefox? If so, can you turn it on and pull up the Console panel to see what errors may be present?

My guess is that it's not working because you're trying to load a texture locally. Browsers treat all files loaded locally as if they are from different domains (cross-domain) and FireFox 5 will error out if this happens.

Can you host your files either through a web host or on your computer through Apache? I'm guessing doing so will fix the issue.

For more information on FF5 and cross-domain textures: http://hacks.mozilla.org/2011/06/cross-domain-webgl-textures-disabled-in-firefox-5/

@01miru
01miru commented Jul 11, 2011

This is the same as the files are on the server. I get this message:

uncaught exception: [Exception... "Failure arg 5 [nsIDOMWebGLRenderingContext.texImage2D]" nsresult: "0x80004005 (NS_ERROR_FAILURE)" location: "JS frame :: file:///C:/Users/miru/Desktop/projekty/cube/build/Three.js :: L :: line 293" data: no]

@alteredq
Contributor

This is the same as the files are on the server

Well, your screenshots and error messages show that you load images from a local file system (file://), not a server (http://).

What's curious is that it works for you on Chrome. For local files to work on Chrome, it has to be started with --allow-file-access-from-files command line flag.

For Firefox, there is a similar parameter security.fileuri.strict_origin_policy accessible via about:config.

Or, as @chandlerprall suggested, you could run local server: Apache, nginx, or if you already have Python installed, there is trivial way how to serve local files via simple server:

$ cd /home/somedir
$ python -m SimpleHTTPServer

http://www.linuxjournal.com/content/tech-tip-really-simple-http-server-python

@01miru
01miru commented Jul 11, 2011

Sorry, my mistake. When loading from server works fine :)

@01miru 01miru closed this Jul 11, 2011
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment