You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(realsense-viewer): viewport grid and metadata overlay
Adds an optional 2D viewport grid overlay to the realsense-viewer,
compiled under the BUILD_VIEWPORT_GRID_OVERLAY CMake flag (default OFF).
Feature summary
- Grid lines rendered over each 2D stream viewport using OpenGL
(glBegin/GL_LINES) with glPushAttrib(GL_CURRENT_BIT) to prevent
color-state bleed into PiP thumbnails
- Two new toggle buttons in each stream header:
- Grid icon (fa-th ): show/hide the grid overlay
- Info icon: show/hide viewport metadata overlay
Both buttons start OFF at every launch (state is not persisted)
- Per-stream grid config: horizontal lines [1-5], vertical lines [1-5],
line width (>=1), RGB color [0-255 each]; out-of-range values fall
back to defaults (not clamped)
Configuration (realsense-config.json)
- Grid settings stored under viewer_model.grid.* using dot-path nested
JSON API (get_nested / set_nested / set_nested_default)
- Defaults are written only in two cases:
1. New file: config_file tracks _is_new_file (set in the
file-based constructor when load_from_file returns nothing);
ux_window writes defaults on startup when is_new_file() is true
2. Restore Defaults button: viewer.cpp injects grid defaults into
temp_cfg immediately after the reset, so they are saved on OK/Apply
- Existing configs without the grid section are left untouched
Files changed
- CMake/lrs_options.cmake: add BUILD_VIEWPORT_GRID_OVERLAY option (OFF)
- common/device-model.h: configurations::viewer::viewport_grid namespace
with the six JSON key constants
- common/textual-icons.h: textual_icons::grid icon (, fa-th)
- common/rs-config.h / rs-config.cpp: is_new_file() accessor backed by
_is_new_file member set in the filename constructor
- common/stream-model.h / stream-model.cpp: grid state members, toggle
buttons, draw_2d_grid() helper; constructor reads grid config from JSON
- common/ux-window.cpp: write grid defaults on new-file startup
- common/viewer.cpp: write grid defaults when Restore Defaults is pressed
- tools/realsense-viewer/CMakeLists.txt: target_compile_definitions for
BUILD_VIEWPORT_GRID_OVERLAY
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Copy file name to clipboardExpand all lines: CMake/lrs_options.cmake
+1Lines changed: 1 addition & 0 deletions
Original file line number
Diff line number
Diff line change
@@ -63,3 +63,4 @@ option(USE_EXTERNAL_LZ4 "Use externally build LZ4 library instead of building an
63
63
option(BUILD_ASAN"Enable AddressSanitizer"OFF)
64
64
option(BUILD_ROSBAG2"Build and use rosbag2 recording system"ON) # temporary flag, should be removed when deprecated ROSBAG1 recording system is removed
65
65
mark_as_advanced(BUILD_ASAN)
66
+
option(BUILD_VIEWPORT_GRID_OVERLAY"Build 2D viewport grid overlay for realsense-viewer (configurable via config-settings.xml)"OFF)
0 commit comments