A cross-platform Zig graphics demo using wgpu-native to render a spinning triangle.
Related Projects:
- wgpu-example - Rust version
- wgpu-example-c - C version
- wgpu-example-odin - Odin version
# Download and setup dependencies (wgpu-native, SDL2, zalgebra)
just setup
# Build and run
just run
| Command | Description |
|---|---|
just setup |
Download wgpu-native, SDL2, and fetch Zig dependencies |
just build |
Build the triangle executable |
just build-release |
Build with release optimizations |
just run |
Build and run the triangle |
just run-release |
Build and run with release optimizations |
just clean |
Remove build artifacts |
wgpu-example-zig/
├── src/
│ └── main.zig # Main source file
├── build.zig # Zig build configuration
├── build.zig.zon # Zig package dependencies
├── justfile # Build commands
├── README.md # This file
├── include/ # Headers (created by setup)
│ ├── webgpu/ # wgpu-native headers
│ └── SDL2/ # SDL2 headers
├── lib/ # Libraries (created by setup)
├── SDL2.dll # SDL2 runtime (created by setup)
└── wgpu_native.dll # wgpu-native runtime (created by setup)
- wgpu-native - Native WebGPU implementation
- SDL2 - Cross-platform windowing and input
- zalgebra - Linear algebra library for Zig
- ESC - Quit the application
- Window can be resized