Feature/viewport grid overlay - #16
Merged
Merged
Conversation
ev-mp
force-pushed
the
feature/viewport-grid-overlay
branch
7 times, most recently
from
May 25, 2026 08:28
f20032c to
f19680d
Compare
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>
ev-mp
force-pushed
the
feature/viewport-grid-overlay
branch
from
May 25, 2026 08:30
f19680d to
5ef5cb6
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
No description provided.