2021-11-17 06:37:56 +11:00
|
|
|
# Hello Pixels + Web
|
|
|
|
|
|
|
|
![Hello Pixels + Web](../../img/minimal-web.png)
|
|
|
|
|
|
|
|
Minimal example for WebGL2.
|
|
|
|
|
|
|
|
## Install build dependencies
|
|
|
|
|
2022-10-03 15:13:48 +11:00
|
|
|
Install the WASM32 target:
|
2021-11-17 06:37:56 +11:00
|
|
|
|
|
|
|
```bash
|
|
|
|
rustup target add wasm32-unknown-unknown
|
|
|
|
```
|
|
|
|
|
|
|
|
## Running on the Web
|
|
|
|
|
|
|
|
Build the project and start a local server to host it:
|
|
|
|
|
|
|
|
```bash
|
2022-10-03 15:13:48 +11:00
|
|
|
cargo run-wasm --release minimal-web
|
2021-11-17 06:37:56 +11:00
|
|
|
```
|
|
|
|
|
2022-10-03 15:13:48 +11:00
|
|
|
Open http://localhost:8000/ in your browser to run the example.
|
2021-11-17 06:37:56 +11:00
|
|
|
|
|
|
|
To build the project without serving it:
|
|
|
|
|
|
|
|
```bash
|
2022-10-03 15:13:48 +11:00
|
|
|
cargo run-wasm --release --build-only minimal-web
|
2021-11-17 06:37:56 +11:00
|
|
|
```
|
|
|
|
|
2022-10-03 15:13:48 +11:00
|
|
|
The build files are stored in `./target/wasm-examples/minimal-web/`.
|
2021-11-17 06:37:56 +11:00
|
|
|
|
|
|
|
## Running on native targets
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cargo run --release --package minimal-web
|
|
|
|
```
|
|
|
|
|
|
|
|
## About
|
|
|
|
|
|
|
|
This example is based on `minimal-winit`, demonstrating how to build your app for WebGL2 targets.
|