Skip to content

Static WebGL image. #25

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

Merged
merged 11 commits into from
Jan 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,5 @@
# Added by cargo

/target

web_crate/target/
2 changes: 2 additions & 0 deletions book_src/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,7 @@
* [Win32 Cleanup](opening_a_window/win32_cleanup.md)
* [Loading OpenGL](loading_opengl/index.md)
* [Win32](loading_opengl/win32.md)
* [Web Stuff](web_stuff/index.md)
* [WebGL with bare WASM](web_stuff/web_gl_with_bare_wasm.md)
* [Appendix](appendix/index.md)
* [UTF-16 Literals](appendix/utf16_literals.md)
20 changes: 20 additions & 0 deletions book_src/web_stuff/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

# Web Nonsense

People really like to run stuff in the browser.
It's very nice to end users if they can just open a web page and not have to install a whole thing.

If you want to run Rust code in a browser you compile it to [WebAssembly](https://en.wikipedia.org/wiki/WebAssembly),
or WASM for short,
which is an output target the same as compiling for windows x86_64,
or linux arm,
or any other target.

Even then, Wasm is strongly sandboxed, and it cannot directly interact with the world.
Not only do you have to bind to some external functions on the Rust side,
you have to *write those external functions yourself* in javascript.
This is a bit of a bother,
and so,
*for this one target platform*,
we'll first see how to do it ourselves,
and then we'll see how to leverage the most common crate for targeting wasm.
Loading