Skip to content

Commit f012d01

Browse files
Merge pull request #467 from MapsHD/mp/rl_step2
[POC] Replace GLUT with Raylib
2 parents cf656e2 + 0a1469e commit f012d01

21 files changed

Lines changed: 11428 additions & 118 deletions

.github/workflows/cmake-linux-deb.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Load repository cache
2424
run: sudo apt-get update --allow-releaseinfo-change
2525
- name: Install Libs
26-
run: sudo apt-get install -y --no-install-recommends libeigen3-dev libglew-dev freeglut3-dev libx11-dev libxi-dev libtbb-dev liblaszip-dev libopencv-dev libproj-dev
26+
run: sudo apt-get install -y --no-install-recommends libeigen3-dev libglew-dev freeglut3-dev libx11-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev libxext-dev libtbb-dev liblaszip-dev libopencv-dev libproj-dev
2727

2828
- uses: actions/checkout@v4
2929
with:

.github/workflows/cmake-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ jobs:
2323
- name: Load repository cache
2424
run: sudo apt-get update --allow-releaseinfo-change
2525
- name: Install Libs
26-
run: sudo apt-get install -y --no-install-recommends libx11-dev libxi-dev libtbb-dev libegl1-mesa-dev libglu1-mesa-dev libopencv-dev libproj-dev
26+
run: sudo apt-get install -y --no-install-recommends libx11-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev libxext-dev libtbb-dev libegl1-mesa-dev libglu1-mesa-dev libopencv-dev libproj-dev
2727

2828
- uses: actions/checkout@v4
2929
with:

.github/workflows/python-bindings-linux.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
run: sudo apt-get update --allow-releaseinfo-change
2222

2323
- name: Install system libraries
24-
run: sudo apt-get install -y --no-install-recommends libx11-dev libxi-dev libtbb-dev libegl1-mesa-dev libglu1-mesa-dev libopencv-dev libproj-dev
24+
run: sudo apt-get install -y --no-install-recommends libx11-dev libxi-dev libxrandr-dev libxinerama-dev libxcursor-dev libxext-dev libtbb-dev libegl1-mesa-dev libglu1-mesa-dev libopencv-dev libproj-dev
2525

2626
- uses: actions/checkout@v4
2727
with:

CMakeLists.txt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,13 @@ include(cmake/implot.cmake)
9090
# ============================================================================
9191
include(cmake/dependencies.cmake)
9292

93+
# raylib/imgui_raylib/rlimgui/imguizmo_raylib targets, needed before
94+
# add_subdirectory(core) below since core's own CMakeLists.txt defines a
95+
# core_raylib target (holding shared raylib rendering/camera/picking code,
96+
# e.g. core/include/Core/raylib_render.hpp) that links against them. Required
97+
# unconditionally: apps/multi_view_tls_registration (step2) is raylib-based.
98+
include(cmake/raylib.cmake)
99+
93100
# ============================================================================
94101
# Core Library
95102
# ============================================================================
@@ -106,10 +113,11 @@ if(BUILD_WITH_HD_MAPPER_APPLICATION)
106113
add_subdirectory(apps/hd_mapper)
107114
endif()
108115

109-
add_subdirectory(apps/lidar_odometry_step_1)
116+
add_subdirectory(apps/lidar_odometry_step_1)
110117
add_subdirectory(apps/manual_color)
111118
add_subdirectory(apps/multi_session_registration)
112119
add_subdirectory(apps/multi_view_tls_registration)
120+
add_subdirectory(apps/multi_view_tls_registration_legacy)
113121
add_subdirectory(apps/split_multi_livox)
114122
add_subdirectory(apps/precision_forestry_tools)
115123
add_subdirectory(apps/mandeye_raw_data_viewer)

README.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,18 @@ cmake -B build -S . -DCMAKE_BUILD_TYPE=Release
6363
cmake --build build --config Release -j
6464
```
6565

66+
**Laptops with hybrid NVIDIA/Intel graphics:** the raylib-based apps (e.g. `multi_view_tls_registration_step_2`) may default to the integrated GPU even with `prime-select nvidia` set, since PRIME's on-demand/offload mode is a per-launch choice, not a system default. Force the discrete NVIDIA GPU with:
67+
68+
```bash
69+
__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia ./build/bin/multi_view_tls_registration_step_2
70+
```
71+
72+
If the `nvidia-prime` package is installed, `prime-run` wraps the same env vars:
73+
74+
```bash
75+
prime-run ./build/bin/multi_view_tls_registration_step_2
76+
```
77+
6678
## Quick Start (macOS)
6779

6880
**Prerequisites:**

apps/multi_view_tls_registration/CMakeLists.txt

Lines changed: 34 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,27 @@ cmake_minimum_required(VERSION 4.0.0)
33
project(multi_view_tls_registration_step_2)
44

55
# Source files
6+
#
7+
# multi_view_tls_registration_gui.cpp is raylib-based: the GLUT-window-and-
8+
# input-loop and point-cloud/loop-closure rendering code that used to go
9+
# through core's own legacy-GL PointCloud::render()/PointClouds::render()
10+
# now uses Core/raylib_render.hpp's ScanRenderer instead.
11+
#
12+
# rl_utils.cpp/rl_utils.h are this app's own raylib-based replacement for
13+
# the camera/picking/mini-compass/misc-ImGui-widget API it used to get from
14+
# core/src/utils.cpp (shared with the remaining GLUT apps, so it can't be
15+
# changed), using rlgl's rl*() legacy-GL-emulation API instead of real
16+
# gl*()/glu*()/glut*() calls -- see rl_utils.h's top comment.
17+
#
18+
# perform_experiment.cpp still #includes GLUT/glew/imgui-GLUT-backend headers,
19+
# but never calls anything from them (verified: no glut*/GL_*/ImGui_Impl*
20+
# symbols referenced in its body) -- those are dead includes left as-is, kept
21+
# resolvable via the include dirs below rather than editing that file.
622
set(SOURCES
7-
multi_view_tls_registration.cpp perform_experiment.cpp
23+
multi_view_tls_registration.cpp perform_experiment.cpp
824
multi_view_tls_registration_gui.cpp multi_view_tls_registration.h
25+
rl_utils.cpp rl_utils.h
926
../lidar_odometry_step_1/lidar_odometry_utils.cpp
10-
"../../core/src/utils.cpp"
1127
)
1228

1329
# Windows: add resource file
@@ -25,12 +41,14 @@ target_include_directories(
2541
multi_view_tls_registration_step_2
2642
PRIVATE include
2743
${REPOSITORY_DIRECTORY}/core/include
28-
${THIRDPARTY_DIRECTORY}/glm
2944
${EIGEN3_INCLUDE_DIR}
3045
${THIRDPARTY_DIRECTORY}
46+
${THIRDPARTY_DIRECTORY}/glm
47+
# For perform_experiment.cpp's unused-but-still-#included glm/GLUT/
48+
# glew/imgui-GLUT-backend headers (see note above) -- not otherwise
49+
# needed now that rendering goes through core_raylib.
3150
${THIRDPARTY_DIRECTORY}/imgui
3251
${THIRDPARTY_DIRECTORY}/imgui/backends
33-
${THIRDPARTY_DIRECTORY}/ImGuizmo
3452
${THIRDPARTY_DIRECTORY}/glew-cmake/include
3553
${FREEGLUT_INCLUDE_DIR}
3654
${THIRDPARTY_DIRECTORY}/json/include
@@ -42,18 +60,23 @@ target_include_directories(
4260

4361
target_link_libraries(
4462
multi_view_tls_registration_step_2
45-
PRIVATE
63+
PRIVATE
64+
# core_raylib brings in core + raylib transitively (PUBLIC link,
65+
# see core/CMakeLists.txt) -- ScanRenderer (the GPU point-cloud
66+
# renderer this app uses) lives there. FREEGLUT_LIBRARY is linked
67+
# PUBLIC by core_raylib rather than here, so it lands correctly
68+
# ordered relative to libcore.a on the final link line -- see the
69+
# comment there for why.
70+
core_raylib
71+
imgui_raylib
72+
rlimgui
73+
imguizmo_raylib
4674
WGS84toCartesian
4775
wgs84_do_puwg92
4876
unordered_dense::unordered_dense
4977
spdlog::spdlog
50-
OpenGL::GLU
51-
${FREEGLUT_LIBRARY}
52-
${OPENGL_gl_LIBRARY}
5378
${PLATFORM_LASZIP_LIB}
5479
${PLATFORM_MISCELLANEOUS_LIBS}
55-
${CORE_LIBRARIES}
56-
${GUI_LIBRARIES}
5780
PROJ::proj)
5881

5982
if(WIN32)
@@ -71,4 +94,4 @@ if (MSVC)
7194
target_compile_options(multi_view_tls_registration_step_2 PRIVATE /bigobj)
7295
endif()
7396

74-
install (TARGETS multi_view_tls_registration_step_2 DESTINATION bin)
97+
install (TARGETS multi_view_tls_registration_step_2 DESTINATION bin)

0 commit comments

Comments
 (0)