Examples » Triangle using Vulkan

Directly using Vulkan with hand-written SPIR-V to produce a triangle offscreen.


This example has equivalent output to the OpenGL Triangle example, but uses Vulkan instead. Showcases how to use Magnum builtin flextGL-generated headers to load Vulkan function pointers, create the Vulkan instance, create the device, do the initial setup, handcraft a SPIR-V shader bytecode and render a basic rainbow triangle offscreen, exporting it to a PNG file using the Trade::AbstractImageConverter APIs.


Full source code is linked below and together with assets also available in the magnum-examples GitHub repository. This example depends on the Vk library that's not enabled by default in most cases, see its documentation for usage instructions.