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

offline rendering #33

Closed
dafhi opened this issue Aug 20, 2019 · 7 comments
Closed

offline rendering #33

dafhi opened this issue Aug 20, 2019 · 7 comments

Comments

@dafhi
Copy link

dafhi commented Aug 20, 2019

github demos work. zip file .. not so much. black image w/ 60 fps

@erichlof
Copy link
Owner

erichlof commented Aug 22, 2019

Hi @dafhi

Yes since the demos all require http get requests - nothing will work unless you have a simple server running in the background, serving up the various files. Images such as textures that the demos need and files such as the shaders (external .glsl files) cannot be loaded from your hard drive directly as this is a violation of CORS policy, which prevents cross-origin resource sharing. If this safety feature was not in place, .html web pages could access private files on your hard drive if those .html files contained malicious JavaScript code.

The easiest way to get my (and other web-based) projects going is to use Microsoft's free Visual Studio Code editor. After it's installed, get the Live web server extension (available inside the editor), then restart the Code editor. When the editor opens up, click Open File... then navigate to my gh-pages folder that you unzipped to your hard drive after the GitHub download. Open up a random .html demo file (CornellBox.html for example) from the menu on the left side of your editor, and then right click on the code and click Open with Live server. It will automatically open up your default browser and hopefully every demo should work. The great thing is that if you want to make changes to my fragment shaders (the heart of every demo), even if you make a one character change while the Live server is running, it will automatically re-compile the shader and you can instantly see your changes (assuming that the new code is syntactically correct). This fast iteration turnaround is one of the reasons I chose a web-based project instead of C++ and OpenGL for instance.

The reason why my project works on GitHub is that if you offer up your project as an open source project, GitHub agrees to serve it up for free. So it's like getting free web hosting for your website (or my demos that are technically like little individual .html websites), as long as you keep the code visible to the public. I have no problem doing this as I was offering source code and finished games for free back in 1999 before open source was a 'thing'! :-D

Let me know if you need any further help getting everything going.

@dafhi
Copy link
Author

dafhi commented Aug 23, 2019

after selecting 'open w live server'

msg box
http://127.0.0.1:5500/arctic_circle.html
application not found

@erichlof
Copy link
Owner

mmm that's odd, I've never received that message before. Here's a screenshot of my editor. Make sure you have the latest version of Live Server extension installed (5.6.1 is the current version at the moment). It should appear in the list of extensions on left-hand side of editor.

editor

@erichlof
Copy link
Owner

here's one more screenshot showing the file view. The editor needs to see the whole gh-pages folder at once, so you have to click Open Folder... (not File as you would normally do) and select the entire gh-pages folder that is unzipped on your hard drive. Once you see that all the files show up in the file explorer column, then left click ArcticCircle.html for instance (like in my 1st screenshot), then right click and select open with Live Server. On the bottom right corner, it should have the port number (5500 for instance) if the server started up successfully.

editor2

@dafhi
Copy link
Author

dafhi commented Aug 23, 2019

googled "Live Server" and "application not found"

comments mentioned that a browser window is opened. I deleted IE a while back and never clicked "make default browser" in Firefox

everything's working now :D

@dafhi dafhi closed this as completed Aug 23, 2019
@erichlof
Copy link
Owner

@dafhi
Yay! Glad everything is working now! Yes it should work with any modern browser such as Chrome, Firefox and even Microsoft Edge (provided that you install the Edge Dev channel version that mirrors the WebGL 2.0 support of Chrome - my project demos all require WebGL 2.0 support).

Thanks!

@dafhi
Copy link
Author

dafhi commented Apr 2, 2020

excellent updates recently! noticeably faster on my humble i4210u. looking forward to more

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants