All examples uses the wrapper package.
Tested in Odin: dev-2024-08:8694fa5f7
.
Execute the odin build
command inside the examples
folder or use the script.
All examples are compiled in the build
folder, where some shared assets are need between examples. Shader files are #load
at compile time and are located within the example.
By default the examples are built in debug mode with the flag -debug
.
You can use the build_win.bat
with a example name as argument, for example:
.\build_win.bat cube_textured
To run the examples you need wgpu_native.dll
along side the examples executables, just place this file in the build
directory. Examples that use the framework need SDL2.dll
that can be copied from your Odin installation in \vendor\sdl2\SDL2.dll
to the build
directory.
To build optimized for release mode, provide a second argument:
.\build_win.bat cube_textured release
If you want to enforce DirectX 12
, change the script build_win.bat
to provide the config as -define:WGPU_BACKEND_TYPE=DX12
:
set ARGS=%ARGS% -define:WGPU_BACKEND_TYPE=DX12
You can use the Makefile
, for example:
make cube_textured
To build optimized for release mode, set the MODE
option to release
:
make cube_textured MODE=release
This is a great Rust tutorial you can read from Learn Wgpu. The challenges are included.