Skip to content

Commit

Permalink
PR #12105 from OhadMeir: Draw cross in calibration ROI
Browse files Browse the repository at this point in the history
  • Loading branch information
Nir-Az authored Aug 14, 2023
2 parents 1f3fdcd + de6a128 commit 84c49ac
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 3 deletions.
18 changes: 16 additions & 2 deletions common/stream-model.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,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 @@ -90,6 +90,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 @@ -1618,7 +1632,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

0 comments on commit 84c49ac

Please sign in to comment.