Skip to content

Commit ad3f54f

Browse files
eliamocornut
authored andcommitted
Examples: Emscripten comments (ocornut#4650, ocornut#4662), standardize readme
1 parent 19c3773 commit ad3f54f

File tree

2 files changed

+22
-4
lines changed

2 files changed

+22
-4
lines changed

examples/example_emscripten_opengl3/README.md

+5-1
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
## How to Build
22

33
- You need to install Emscripten from https://emscripten.org/docs/getting_started/downloads.html, and have the environment variables set, as described in https://emscripten.org/docs/getting_started/downloads.html#installation-instructions
4-
- You may also refer to our [Continuous Integration setup](https://github.com/ocornut/imgui/tree/master/.github/workflows) for Emscripten setup.
4+
55
- Depending on your configuration, in Windows you may need to run `emsdk/emsdk_env.bat` in your console to access the Emscripten command-line tools.
6+
7+
- You may also refer to our [Continuous Integration setup](https://github.com/ocornut/imgui/tree/master/.github/workflows) for Emscripten setup.
8+
69
- Then build using `make` while in the `example_emscripten_opengl3/` directory.
710

811
## How to Run
@@ -15,6 +18,7 @@ _"Unfortunately several browsers (including Chrome, Safari, and Internet Explore
1518
- Emscripten SDK has a handy `emrun` command: `emrun web/example_emscripten_opengl3.html --browser firefox` which will spawn a temporary local webserver (in Firefox). See https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html for details.
1619
- You may use Python 3 builtin webserver: `python -m http.server -d web` (this is what `make serve` uses).
1720
- You may use Python 2 builtin webserver: `cd web && python -m SimpleHTTPServer`.
21+
- If you are accessing the files over a network, certain browsers, such as Firefox, will restrict Gamepad API access to secure contexts only (e.g. https only).
1822

1923
## Obsolete features:
2024

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,24 @@
1-
2-
# How to Build
1+
## How to Build
32

43
- You need to install Emscripten from https://emscripten.org/docs/getting_started/downloads.html, and have the environment variables set, as described in https://emscripten.org/docs/getting_started/downloads.html#installation-instructions
54

65
- Depending on your configuration, in Windows you may need to run `emsdk/emsdk_env.bat` in your console to access the Emscripten command-line tools.
76

7+
- You may also refer to our [Continuous Integration setup](https://github.com/ocornut/imgui/tree/master/.github/workflows) for Emscripten setup.
8+
89
- Then build using `make` while in the `example_emscripten_wgpu/` directory.
910

10-
- Requires Emscripten 2.0.10 (December 2020) due to GLFW adaptations
11+
- Requires recent Emscripten as WGPU is still a work-in-progress API.
12+
13+
## How to Run
14+
15+
To run on a local machine:
16+
- Make sure your browse supports WGPU and it is enabled. WGPU is still WIP not enabled by default in most browser.
17+
- `make serve` will use Python3 to spawn a local webserver, you can then browse http://localhost:8000 to access your build.
18+
- Otherwise, generally you will need a local webserver:
19+
- Quoting [https://emscripten.org/docs/getting_started](https://emscripten.org/docs/getting_started/Tutorial.html#generating-html):<br>
20+
_"Unfortunately several browsers (including Chrome, Safari, and Internet Explorer) do not support file:// [XHR](https://emscripten.org/docs/site/glossary.html#term-xhr) requests, and can’t load extra files needed by the HTML (like a .wasm file, or packaged file data as mentioned lower down). For these browsers you’ll need to serve the files using a [local webserver](https://emscripten.org/docs/getting_started/FAQ.html#faq-local-webserver) and then open http://localhost:8000/hello.html."_
21+
- Emscripten SDK has a handy `emrun` command: `emrun web/example_emscripten_opengl3.html --browser firefox` which will spawn a temporary local webserver (in Firefox). See https://emscripten.org/docs/compiling/Running-html-files-with-emrun.html for details.
22+
- You may use Python 3 builtin webserver: `python -m http.server -d web` (this is what `make serve` uses).
23+
- You may use Python 2 builtin webserver: `cd web && python -m SimpleHTTPServer`.
24+
- If you are accessing the files over a network, certain browsers, such as Firefox, will restrict Gamepad API access to secure contexts only (e.g. https only).

0 commit comments

Comments
 (0)