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 crosshair overlay to the realsense-viewer.
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
- refactor(viewer): make viewport grid overlay a built-in capability
- Drop BUILD_VIEWPORT_GRID_OVERLAY cmake option and remove all #ifdef
guards — the feature is now always compiled into realsense-viewer.
- Rename draw_2d_grid to draw_crosshair per review request.
- Update grid overlay button tooltips
- Align hover hint text with draw_crosshair rename.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
0 commit comments