Skip to content
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

Cherry pick PR #12105 from OhadMeir: Draw cross in calibration ROI #12169

Merged
merged 1 commit into from
Sep 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions common/stream-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ namespace rs2
glPopAttrib();
}

void draw_rect(const rect& r, int line_width)
void draw_rect( const rect & r, int line_width, bool draw_cross )
{
glPushAttrib(GL_ENABLE_BIT);

Expand All @@ -96,6 +96,20 @@ namespace rs2
glVertex2f(r.x, r.y);
glEnd();

if( draw_cross )
{
glLineStipple( 1, 0x0808 );
glEnable( GL_LINE_STIPPLE );
glBegin( GL_LINES );
glVertex2f( r.x, r.y + r.h / 2 );
glVertex2f( r.x + r.w, r.y + r.h / 2 );
glEnd();
glBegin( GL_LINES );
glVertex2f( r.x + r.w / 2, r.y );
glVertex2f( r.x + r.w / 2, r.y + r.h );
glEnd();
}

glPopAttrib();
}

Expand Down Expand Up @@ -1541,7 +1555,7 @@ namespace rs2

r = r.normalize(_normalized_zoom.unnormalize(get_original_stream_bounds())).unnormalize(stream_rect).cut_by(stream_rect);
glColor3f(yellow.x, yellow.y, yellow.z);
draw_rect(r, 2);
draw_rect(r, 2, true);

std::string message = "Metrics Region of Interest";
auto msg_width = stb_easy_font_width((char*)message.c_str());
Expand Down
2 changes: 1 addition & 1 deletion common/stream-model.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ namespace rs2
class subdevice_model;
class viewer_model;

void draw_rect(const rect& r, int line_width = 1);
void draw_rect(const rect& r, int line_width = 1, bool draw_cross = false);

struct frame_metadata
{
Expand Down
Loading