Rendering a Dear ImGui user interface with Vulkan
In Chapter 3, Getting Started with OpenGL and Vulkan, we demonstrated how to render the Dear ImGui user interface using OpenGL in 200 lines of C++ code. Here we try to transfer this knowledge to Vulkan and complement our existing frame composition routines. Even though fitting the entire Vulkan ImGui renderer into a few hundred lines of code is definitely not possible, we will do our best to keep the implementation reasonably compact for it to serve as a good teaching example.
Getting ready
It is recommended to revisit the Rendering a basic UI with Dear ImGui recipe from Chapter 2, Using Essential Libraries, and also recall our Vulkan frame composition scheme described in the first two recipes of this chapter.
This recipe covers the source code of shared/vkRenderers/VulkanImGui.cpp
.
How to do it...
Let's take a look at the minimalistic ImGui Vulkan renderer implementation, which takes the ImDrawData
data structure...