Examples » Triangle using Vulkan

Using Vulkan with SPIR-V assembly to produce a triangle offscreen.

Image

This example has equivalent output to the OpenGL Triangle example, but uses Vulkan instead. Showcases how to use the Vk library to create the Vulkan instance, create the device, do the initial setup, assemble a SPIR-V shader bytecode using the SpirvToolsShaderConverter plugin and render a basic rainbow triangle offscreen, exporting it to a PNG file using the Trade::AbstractImageConverter APIs.

Source

Full source code is linked below and together with assets also available in the magnum-examples GitHub repository. This example depends on the Trade, ShaderTools and Vk libraries and in addition needs the AnyImageConverter plugin and some PngImageConverter implementation – see File format support. Not all are enabled by default in most cases, see their documentation for usage instructions.