Wavy - A BGFX marching squares implementation
What is it? - Building - References
Wavy is a C++ program that implements a marching squares algorithm for generating waves and makes use of the the BGFX graphics library.
This was a project to learn how graphics are made. To gain an appreciation for rendering, graphics libraries, and engines.
- CMake ≥ 3.16
- Make and a C++ compiler (GCC)
- Git (for submodule checkout)
- Linux build deps:
libx11-dev,libgl-dev(for native Linux builds) - MinGW-w64 with the posix threading model (for Windows cross-compile only):
sudo apt install mingw-w64 g++-mingw-w64-x86-64-posix gcc-mingw-w64-x86-64-posix sudo update-alternatives --set x86_64-w64-mingw32-g++ /usr/bin/x86_64-w64-mingw32-g++-posix sudo update-alternatives --set x86_64-w64-mingw32-gcc /usr/bin/x86_64-w64-mingw32-gcc-posix
git clone --recursive https://github.com/Yocoholo/wavyCPP.git
cd wavyCPPmkdir build && cd build
cmake .. -DCMAKE_BUILD_TYPE=Release
cmake --build .Run:
./wavy --type opengl # or --type vulkanmkdir build && cd build
cmake .. -DCMAKE_TOOLCHAIN_FILE=../cmake/mingw-w64-x86_64.cmake -DCMAKE_BUILD_TYPE=Release
cmake --build .Run (on Windows or WSL):
./wavy.exe # DX11 by default, or --type vulkan / --type openglThe first cmake --build . will automatically:
- Build bgfx static libraries for your platform (stamp-file cached — only runs once)
- Build a native Linux shaderc if cross-compiling (for SPIR-V / GLSL shaders)
- Compile shaders for all available backends (DX11, SPIR-V, GLSL)
- Build wavy
Subsequent builds only recompile what changed. Editing .sc shader files triggers automatic shader recompilation.
Note: The posix threading model is required for MinGW — the win32 model lacks
std::mutexsupport needed by bimg's ASTC encoder.
mkdir build-debug && cd build-debug
cmake .. -DCMAKE_BUILD_TYPE=Debug # add toolchain file for Windows target
cmake --build .cmake --build build --target build_bgfxBGFX - The graphics library used in this project.
BGFX starter template - While not entirely used, was useful when starting this project.
