This is a template repository to get started with WGPU (24.0.1) + Winit (0.30.8).
The template supports cross-platform compilation for Windows, Linux, MacOS and WebAssembly, utilizing WebGPU/WebGL with trunk.
# Clone the repository and open it
git clone https://github.com/Foxicution/wgpu-template
cd wgpu-template
# To run natively (Windows/MacOS/Linux)
cargo run
# To run on the web with WebAssembly (WASM)
# Add target wasm32-unknown-unknown for WASM builds
rustup target add wasm32-unknown-unknown
# Install trunk for WASM builds
cargo install --locked trunk
# With WebGL (for browsers that don't support WebGPU)
trunk serve --features webgl --open
# With WebGPU
trunk serve --open
For web builds, the app will be running on http://localhost:8080.
To check if your browser supports WebGPU go here.
If you run into any issues while using the template, feel free to submit a Github issue or a Pull Request.
References and projects that helped create this template: