This is a template of Imgui + Implot Project, with opengl + glfw backend.
This template is built with CMake, supporting both Windows and Linux.
- OpenGL
On Windows, you can download it in Visual Studio.
git clone https://github.com/Mes0903/Mes_Imgui_template.git
cd Mes_Imgui_template
git submodule init
git submodule update
mkdir build && cd build
cmake ..
cmake --build .
if you are using WSL as your environment, you may encounter the wayland-scanner error:
... failed to find wayland-scanner
In this case, you can uncomment the cmake flag for glfw to disable wayland:
# 3rdparty/CMakeLists.txt
if(UNIX)
set(GLFW_BUILD_DOCS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_TESTS OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
set(GLFW_BUILD_WAYLAND OFF CACHE BOOL "" FORCE)
endif()
add_subdirectory(glfw)
Glad in this template is for opengl 4.6, so you need to change the version of glad if you are using a different version of opengl.
You can download the correspond version on the glad loader website.
I'm not quite familar with mingw, but this is how I compile with mingw64:
C:\mingw64\bin\cmake.EXE --no-warn-unused-cli -DCMAKE_BUILD_TYPE:STRING=Release -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_C_COMPILER:FILEPATH=C:\mingw64\bin\gcc.exe -DCMAKE_CXX_COMPILER:FILEPATH=C:\mingw64\bin\g++.exe -SD:/document/GitHub/Mes_Imgui_template -Bd:/document/GitHub/Mes_Imgui_template/build -G "MinGW Makefiles"
cd build
cmake --build .
The path of my project was D:\document\GitHub\Mes_Imgui_template
, and the path of my mingw was C:\mingw64
, please changed the path to yours.
(This command is generated by Visual Studio Code, so it may not be the best way to compile with mingw64.)