An example triangle rendering program based on Vulkan Tutorial.
The executable renders a single three-color triangle that looks roughly like the image provided in the tutorial. Q key or any program termination signal exits the program.
GLFW is used to create a window in a platform-independent fashion.
The code closely follows the tutorial from the Introduction up until and including Vertex buffer creation, however there are a few deviations:
-
VK_PRESENT_MODE_FIFO_KHRis used instead ofVK_PRESENT_MODE_MAILBOX_KHR; -
Precompiled shaders are baked directly into the code;
-
vkWaitFencesresides at the end of the drawing loop instead of at its start; -
VulkanMemoryAllocator is used to allocate the vertex buffer.
This application overrelies on throwing exceptions via fail for error handling,
this is an intentional choice in the name of code brevity.