Starting-point for platform-independent graphics projects based on Vulkan and SDL.
General Features:
- A "Hello Triangle"-style (3D "Hello World") main program, but including:
- unified reworked examples from Vulkan Tutorial
- a bonus shader-based ray-marching example (thanks ShaderToy)!
- Object-oriented encapsulation of Vulkan's extensive setup
- RAII and injected dependencies (making their heirarchy obvious)
- Design goals: code that's reusable, modular, minimalist
Specific Features:
- Ranking mechanism to automatically choose the best graphics device
- Abstracts some basic 3D objects and vertex types
Supports:
- iOS and macOS (Xcode 11+) → Mac Build Instructions
- Windows (Visual Studio 2019+) → Windows Build Instructions
- Linux (CMake) → Ubuntu Build Instructions Raspberry Pi 5 Build Instructions
- (Android and VR platform support coming soon!*)
Windows Requisites and Language Notes: Visual Studio 2019 or later is required for this project. Why?
Clang/LLVM is the targeted compiler, C++20/libc++ the intended language variant.
Why another "Hello Vulkan" project? Hopefully this one is different. Some reasoning and justification here.
Find a note about my choice of Unlicense here.
This project requires the following:
- Vulkan SDK
- Simple DirectMedia Layer (SDL)
- OpenGL Mathematics (glm) (note that this is included in the Windows version of #1)
More-specific instructions/links are in each platform-centric subdirectory. (again: Windows here, Mac here)
Whatever location you install these dependencies to, the Project will have to know where to find them, so it can include their header files and link with their library binaries.
In the root directory of the HelloVulkanSDL Project, there will be a subdirectory called External
where the Project's build process looks to find these dependencies. So while you can modify the build settings, it's easiest to do one of these two options:
A. Either install the packages to this External
directory. ...or...
B. Set up symbolic links from within this directory to the locations where you actually have them installed.
To assist you, each platform-specific directory contains a setup1st
script you can run to set up the links.
However, it requires minor editing first.
The script generally assumes you have already installed these packages, where you want them,
so won't overzealously try to install them for you.
* – I could use your help! This project isn't perfect, but I seek to perfect it. If you see problems with how I'm doing something, please submit an issue and tell me. If you'd like to contribute with a pull-request, please do! If you don't like SDL, I tried to generalize it to an interface (iPlatform
) and I added GLFW/STB/WTF files too, but I didn't test these. Feel free to fix and PR. The same goes for the aforementioned Android/VR additions. If you help, of course I'll give you credit as a contributor here.
This project owes much inspiration and appreciation to:
- Alexander Overvoorde's excellent Vulkan Tutorial, which influenced much of my code and from which I blatantly stole sample shaders and assets, in order to rework and re-present them here. His unrestrictive license is generous and I strive to do the same.
- Sascha Willems for his outstanding Examples, contributions to the community, sharing knowledge and helping devs on online forums.
- LunarG for MoltenVK, for free, especially given Apple's limited support for it and their announced deprecation of OpenGL (a back-stab to the open 3D graphics standard to which Apple owes their early iPhone/AppStore success).
- Khronos and partner companies for Vulkan.
- Inigo Quilez for his awe-inspiring work (and generously sharing his secrets) too.