Skip to content

Commit 10659cb

Browse files
Static WebGL image. (#25)
* starting the web. * expand the gitignore. * clear the canvas to blue. * tool advice. * web-lesson-01 completed * Update book_src/web_stuff/index.md Co-authored-by: Joe Clay <[email protected]> * note that wasm-bindgen is the common crate in this domain. * don't say "before we begin" twice. * make the inability to use file:// more obvious * canvas tag inside the body. * expand in the GLintptr note. Co-authored-by: Joe Clay <[email protected]>
1 parent 6f85388 commit 10659cb

File tree

9 files changed

+990
-0
lines changed

9 files changed

+990
-0
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,5 @@
44
# Added by cargo
55

66
/target
7+
8+
web_crate/target/

book_src/SUMMARY.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,7 @@
66
* [Win32 Cleanup](opening_a_window/win32_cleanup.md)
77
* [Loading OpenGL](loading_opengl/index.md)
88
* [Win32](loading_opengl/win32.md)
9+
* [Web Stuff](web_stuff/index.md)
10+
* [WebGL with bare WASM](web_stuff/web_gl_with_bare_wasm.md)
911
* [Appendix](appendix/index.md)
1012
* [UTF-16 Literals](appendix/utf16_literals.md)

book_src/web_stuff/index.md

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
2+
# Web Nonsense
3+
4+
People really like to run stuff in the browser.
5+
It's very nice to end users if they can just open a web page and not have to install a whole thing.
6+
7+
If you want to run Rust code in a browser you compile it to [WebAssembly](https://en.wikipedia.org/wiki/WebAssembly),
8+
or WASM for short,
9+
which is an output target the same as compiling for windows x86_64,
10+
or linux arm,
11+
or any other target.
12+
13+
Even then, Wasm is strongly sandboxed, and it cannot directly interact with the world.
14+
Not only do you have to bind to some external functions on the Rust side,
15+
you have to *write those external functions yourself* in javascript.
16+
This is a bit of a bother,
17+
and so,
18+
*for this one target platform*,
19+
we'll first see how to do it ourselves,
20+
and then we'll see how to leverage the most common crate for targeting wasm.

0 commit comments

Comments
 (0)