-
Notifications
You must be signed in to change notification settings - Fork 129
Introduce Dear ImGui alternative viz module #112
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jlblancoc
wants to merge
1
commit into
develop
Choose a base branch
from
feat/dear-imgui-viz
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,3 +1,7 @@ | ||
| [submodule "3rdparty/robin-map"] | ||
| path = mola_metric_maps/3rdparty/robin-map | ||
| url = https://github.com/Tessil/robin-map.git | ||
| [submodule "mola_viz_imgui/3rdparty/imgui"] | ||
| path = mola_viz_imgui/3rdparty/imgui | ||
| url = https://github.com/ocornut/imgui.git | ||
| branch = docking |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,2 @@ | ||
| DisableFormat: true | ||
| SortIncludes: Never |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # ------------------------------------------------------------------------------ | ||
| # Static library target wrapping Dear ImGui (docking branch). | ||
| # | ||
| # Expected layout: | ||
| # <this file's parent>/../../3rdparty/imgui/ ← git submodule | ||
| # | ||
| # The submodule must be the "docking" branch of | ||
| # https://github.com/ocornut/imgui | ||
| # ------------------------------------------------------------------------------ | ||
|
|
||
| cmake_minimum_required(VERSION 3.5) | ||
| project(imgui_static LANGUAGES CXX) | ||
|
|
||
| # Locate the submodule root relative to this file | ||
| get_filename_component(_IMGUI_ROOT | ||
| "${CMAKE_CURRENT_SOURCE_DIR}/../../3rdparty/imgui" ABSOLUTE) | ||
|
|
||
| if(NOT EXISTS "${_IMGUI_ROOT}/imgui.h") | ||
| message(FATAL_ERROR | ||
| "Dear ImGui submodule not found at ${_IMGUI_ROOT}.\n" | ||
| "Run: git submodule update --init --recursive") | ||
| endif() | ||
|
|
||
| # Find GLFW (already required by mrpt-gui, so it will be present) | ||
| find_package(glfw3 REQUIRED) | ||
| find_package(OpenGL REQUIRED) | ||
|
|
||
| set(_IMGUI_SRCS | ||
| ${_IMGUI_ROOT}/imgui.cpp | ||
| ${_IMGUI_ROOT}/imgui_draw.cpp | ||
| ${_IMGUI_ROOT}/imgui_tables.cpp | ||
| ${_IMGUI_ROOT}/imgui_widgets.cpp | ||
| # ${_IMGUI_ROOT}/imgui_demo.cpp # can be excluded in release builds | ||
| ${_IMGUI_ROOT}/misc/cpp/imgui_stdlib.cpp # std::string InputText support | ||
| ${_IMGUI_ROOT}/backends/imgui_impl_glfw.cpp | ||
| ${_IMGUI_ROOT}/backends/imgui_impl_opengl3.cpp | ||
| ) | ||
|
|
||
| add_library(imgui_static STATIC ${_IMGUI_SRCS}) | ||
| set_target_properties(imgui_static PROPERTIES POSITION_INDEPENDENT_CODE TRUE) | ||
|
|
||
| target_include_directories(imgui_static | ||
| PUBLIC | ||
| ${_IMGUI_ROOT} | ||
| ${_IMGUI_ROOT}/backends | ||
| ${_IMGUI_ROOT}/misc/cpp | ||
| ) | ||
|
|
||
| # Enable the docking branch feature set: | ||
| target_compile_definitions(imgui_static | ||
| PUBLIC | ||
| IMGUI_ENABLE_DOCKING # activates docking API | ||
| IMGUI_IMPL_OPENGL_LOADER_GLEW # or GLAD — adjust to whatever mrpt uses | ||
| ) | ||
|
|
||
| target_link_libraries(imgui_static | ||
| PUBLIC | ||
| glfw | ||
| OpenGL::GL | ||
| ) | ||
|
|
||
| # Suppress warnings from third-party code | ||
| if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang") | ||
| target_compile_options(imgui_static PRIVATE -w) | ||
| endif() | ||
|
|
||
| # Export as an alias so parent CMake can use it as imgui::imgui | ||
| add_library(imgui::imgui ALIAS imgui_static) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| # ------------------------------------------------------------------------------ | ||
| # A Modular Optimization framework for Localization and mApping | ||
| # (MOLA) | ||
| # | ||
| # Copyright (C) 2018-2026, Jose Luis Blanco-Claraco, contributors (AUTHORS.md) | ||
| # All rights reserved. | ||
| # Released under GNU GPL v3. See LICENSE file | ||
| # ------------------------------------------------------------------------------ | ||
|
|
||
| cmake_minimum_required(VERSION 3.5) | ||
| project(mola_viz_imgui LANGUAGES CXX) | ||
|
|
||
| # MOLA CMake scripts: "mola_xxx()" | ||
| find_package(mola_common REQUIRED) | ||
|
|
||
| # -- External dependencies ---------------------------------------------------- | ||
| find_package(mrpt-maps REQUIRED) | ||
| find_package(mrpt-opengl REQUIRED) | ||
| find_package(mrpt-obs REQUIRED) | ||
| find_mola_package(mola_kernel) | ||
|
|
||
| # GLFW is needed explicitly for our own GLFW window management. | ||
| find_package(glfw3 REQUIRED) | ||
|
|
||
| set(OpenGL_GL_PREFERENCE GLVND) | ||
| find_package(OpenGL REQUIRED) | ||
|
|
||
| # -- Dear ImGui static library (from 3rdparty submodule) --------------------- | ||
| # | ||
| # The submodule lives at: <repo_root>/3rdparty/imgui (docking branch) | ||
| # The helper CMakeLists that builds it as a static lib lives at: | ||
| # 3rdparty/imgui_static/CMakeLists.txt | ||
| # | ||
| add_subdirectory(3rdparty/imgui_static imgui_static_build) | ||
| # After this, the target imgui::imgui is available. | ||
|
|
||
| # -- Module sources ----------------------------------------------------------- | ||
| set(LIB_SRCS | ||
| src/MolaVizImGui_handlers.cpp | ||
| src/MolaVizImGui.cpp | ||
| src/MolaVizImGui_widgets.cpp | ||
| ) | ||
| set(LIB_PUBLIC_HDRS | ||
| include/mola_viz_imgui/MolaVizImGui.h | ||
| ) | ||
|
|
||
| mola_add_library( | ||
| TARGET ${PROJECT_NAME} | ||
| SOURCES ${LIB_SRCS} ${LIB_PUBLIC_HDRS} | ||
| PUBLIC_LINK_LIBRARIES | ||
| mola::mola_kernel | ||
| mrpt::opengl | ||
| mrpt::maps | ||
| mrpt::obs | ||
| OpenGL::GL | ||
| PRIVATE_LINK_LIBRARIES | ||
| imgui::imgui # Dear ImGui static lib (includes GLFW + OpenGL3 backends) | ||
| # mrpt::gui # only needed for mrpt type helpers, not the nanogui window | ||
coderabbitai[bot] marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| CMAKE_DEPENDENCIES | ||
| mola_kernel | ||
| mrpt-opengl | ||
| mrpt-maps | ||
| mrpt-obs | ||
| ) | ||
|
|
||
| # -- Compiler options --------------------------------------------------------- | ||
| # C++17 required for std::visit, if_constexpr, structured bindings. Already req by MRPT anyway. | ||
| target_compile_features(${PROJECT_NAME} PUBLIC cxx_std_17) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| # mola_viz_imgui | ||
| GUI for MOLA based on Dear ImGui | ||
|
|
||
| Provides the C++ library `libmola_viz_imgui` with a flexible API for any other module | ||
| to display windows, controls, etc. | ||
|
|
||
| ## Build and install | ||
| Refer to the [root MOLA repository](https://github.com/MOLAorg/mola). | ||
|
|
||
| ## Docs and examples | ||
| See this package page [in the documentation](https://docs.mola-slam.org/latest/modules.html). | ||
|
|
||
| ## License | ||
| This package is released under the GNU GPL v3 license. Other options available upon request. |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: MOLAorg/mola
Length of output: 166
🏁 Script executed:
Repository: MOLAorg/mola
Length of output: 1023
🏁 Script executed:
Repository: MOLAorg/mola
Length of output: 2607
🏁 Script executed:
Repository: MOLAorg/mola
Length of output: 1551
OpenGL loader macro is inconsistent with declared dependencies.
IMGUI_IMPL_OPENGL_LOADER_GLEWis enabled, but GLEW is neither found viafind_package()nor linked intarget_link_libraries(). The imgui OpenGL3 backend requires this dependency to compile. This will fail unless GLEW is provided by a parent project or the macro is changed to match an available loader.Fix: Use GLAD or remove to use default
If GLEW is unavailable, either switch to GLAD (if available) or remove the macro line to use the imgui default loader selection:
target_compile_definitions(imgui_static PUBLIC IMGUI_ENABLE_DOCKING # activates docking API - IMGUI_IMPL_OPENGL_LOADER_GLEW # or GLAD — adjust to whatever mrpt uses )Alternatively, add GLEW dependency if it's required by MRPT or another dependency.
🤖 Prompt for AI Agents