Adding ImGui to the OpenGL and Vulkan renderers
To use ImGui in our code, we need a couple of files from the ImGui GitHub repository at https://github.com/ocornut/imgui
Download the following files to a folder named imgui
:
imconfig.h
imgui.cpp
imgui.h
imgui_draw.cpp
imgui_internal.h
imgui_tables.cpp
imgui_widgets.cpp
imstb_rectpack.h
imstb_textedit.h
imstb_truetype.h
These downloaded files are the backend-independent code, containing the implementations of the widgets. We have to include them in our project for ImGui to work in general.
For the GLFW input backend, two additional files are required. Download these two files and put them into the imgui
folder:
imgui_impl_glfw.cpp
imgui_impl_glfw.h
To include the GLFW backend, this line will be needed:
#include <imgui_impl_glfw.h>
You can find the code for this section in the chapter05
folder’s 01_opengl_ui
subfolder for OpenGL and 05_vulkan_ui...