Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pixi won't run locally #33

Closed
samueller opened this issue Mar 29, 2013 · 8 comments
Closed

pixi won't run locally #33

samueller opened this issue Mar 29, 2013 · 8 comments

Comments

@samueller
Copy link

I love the philosophy of pixi.js and the demos are impressive. So I'd really like to teach my students JavaScript through pixi.js. However, it won't run locally (entering file:///C:/etc in the address bar of Chrome) for me. I have to host the HTML/JavaScript code to get the examples to run.

I know I can install a simple local webserver, but then we lose out on live editing (which WebStorm beautifully supports), simplicity and other conveniences. Is there any way I can use pixi.js locally? I get the following error for the Basics example:
Uncaught Error: SecurityError: DOM Exception 18 pixi.js:58
PIXI.WebGLRenderer.updateTexture pixi.js:58
PIXI.WebGLRenderer.render pixi.js:56
animate index.html:51

@GoodBoyDigital
Copy link
Member

Thanks very much :)

I absolutely love the idea of you teaching pixi.js to your students! Unfortunately getting webGL textures to work locally is a bit of a pain. For security reasons, JavaScript is only allowed to access resources from the same domain.

The pixi.js CanvasRender runs fine locally so you could use that maybe?

@Nibbler999
Copy link

You can run it in Firefox if you set the "security.fileuri.strict_origin_policy" preference to false in about:config.

@samueller
Copy link
Author

@Nibbler999 I'd like to use Chrome because that's the only browser that supports live editing with WebStorm, plus there are some other plugins not available in Firefox we use.

CanvasRenderer is fine, I'll have them use that for now. Unfortunately they won't get as wowed by the amazing speed without WebGL. Does it make sense to check the URL of the webpage the JavaScript is on and if it starts with file:/// then use the CanvasRenderer, otherwise use the regular mechanism in the autoDetectRenderer function?

@ateoto
Copy link
Contributor

ateoto commented Mar 29, 2013

A really easy way is to install Python (if you don't already have it). Then from the directory that has your html/js/css in it, just type:

python -m SimpleHTTPServer

or, if you're on Python 3:

python -m http.server

Then you would just point chrome at http://127.0.0.1:8000

There are additional tips and tricks here:
https://github.com/mrdoob/three.js/wiki/How-to-run-things-locally

@samueller
Copy link
Author

@ateoto thank you. I don't want to use a webserver for the reasons cited above. These are kids as young as 6 we're teaching. Your link was insightful. I didn't know there was a configuration parameter in Chrome. However, I'm a bit nervous to have these kids go home with links to security lessened browsers...

@ateoto
Copy link
Contributor

ateoto commented Mar 30, 2013

My apologies, that's what happens when I skim through things. I just took a quick look at WebStorm and it seems as though starting with version 6, it includes a built-in HTTP server, couldn't find any specific documentation on the feature though.

@samueller
Copy link
Author

@ateoto I had no idea about that built-in HTTP server!! This is so helpful, it works amazing! Thanks.

@lock
Copy link

lock bot commented Feb 27, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked and limited conversation to collaborators Feb 27, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants