68 {
70 return;
71
72 const Size cnv_size = canvas.get_canvas_size();
73 const float cnv_width = (float)cnv_size.get_width();
74 const float cnv_height = (float)cnv_size.get_height();
75 if (cnv_width == 0.0f || cnv_height == 0.0f)
76 return;
77
78 const float cnv_inv_width = 1.0f / cnv_width;
79 const float cnv_inv_height = 1.0f / cnv_height;
80 const float left = 2.0f * (
get_left() * cnv_inv_width - 0.5f);
82 const float top = -2.0f * (
get_top() * cnv_inv_height - 0.5f);
83 const float bottom = -2.0f * (
get_bottom() * cnv_inv_height - 0.5f);
84
85#if !SLIC3R_OPENGL_ES
88#endif
89
91
92#if !SLIC3R_OPENGL_ES
97 }
98#endif
99
100#if SLIC3R_OPENGL_ES
101 GLShaderProgram* shader = wxGetApp().get_shader("dashed_lines");
102#else
104#endif
105 if (shader != nullptr) {
106 shader->start_using();
107
112
113 GLModel::Geometry init_data;
114#if !SLIC3R_OPENGL_ES
116#endif
118 init_data.reserve_vertices(5);
119 init_data.reserve_indices(8);
120#if !SLIC3R_OPENGL_ES
121 }
122 else {
124 init_data.reserve_vertices(4);
125 init_data.reserve_indices(4);
126 }
127#endif
128
129
130#if !SLIC3R_OPENGL_ES
132#endif
134 const float height = top - bottom;
135 float perimeter = 0.0f;
136
137 init_data.add_vertex(
Vec4f(left, bottom, 0.0f, perimeter));
139 init_data.add_vertex(
Vec4f(right, bottom, 0.0f, perimeter));
141 init_data.add_vertex(
Vec4f(right, top, 0.0f, perimeter));
143 init_data.add_vertex(
Vec4f(left, top, 0.0f, perimeter));
145 init_data.add_vertex(
Vec4f(left, bottom, 0.0f, perimeter));
146
147
148 init_data.add_line(0, 1);
149 init_data.add_line(1, 2);
150 init_data.add_line(2, 3);
151 init_data.add_line(3, 4);
152#if !SLIC3R_OPENGL_ES
153 }
154 else {
155 init_data.add_vertex(
Vec2f(left, bottom));
156 init_data.add_vertex(
Vec2f(right, bottom));
157 init_data.add_vertex(
Vec2f(right, top));
158 init_data.add_vertex(
Vec2f(left, top));
159
160
161 init_data.add_index(0);
162 init_data.add_index(1);
163 init_data.add_index(2);
164 init_data.add_index(3);
165 }
166#endif
167
169 }
170
171 shader->set_uniform("view_model_matrix", Transform3d::Identity());
172 shader->set_uniform("projection_matrix", Transform3d::Identity());
173#if !SLIC3R_OPENGL_ES
175#endif
176 const std::array<int, 4>& viewport = wxGetApp().plater()->get_camera().get_viewport();
177 shader->set_uniform(
"viewport_size",
Vec2d(
double(viewport[2]),
double(viewport[3])));
178 shader->set_uniform("width", 0.25f);
179 shader->set_uniform("dash_size", 0.01f);
180 shader->set_uniform("gap_size", 0.0075f);
181#if !SLIC3R_OPENGL_ES
182 }
183#endif
184
187 shader->stop_using();
188 }
189
190#if !SLIC3R_OPENGL_ES
193#endif
194 }
#define glsafe(cmd)
Definition OpenGLUtils.hpp:25
static const ColorRGBA ORCA()
Definition Color.hpp:143
float get_right() const
Definition GLSelectionRectangle.hpp:45
Vec2d m_old_start_corner
Definition GLSelectionRectangle.hpp:54
GLModel m_rectangle
Definition GLSelectionRectangle.hpp:53
float get_bottom() const
Definition GLSelectionRectangle.hpp:47
float get_left() const
Definition GLSelectionRectangle.hpp:44
float get_top() const
Definition GLSelectionRectangle.hpp:46
Vec2d m_old_end_corner
Definition GLSelectionRectangle.hpp:55
bool is_core_profile() const
Definition OpenGLManager.hpp:53
static const GLInfo & get_gl_info()
Definition OpenGLManager.hpp:106
#define glEnable
Definition gl.h:3667
#define GL_DEPTH_TEST
Definition gl.h:574
#define GL_LINE_STIPPLE
Definition gl.h:941
#define GL_ENABLE_BIT
Definition gl.h:639
#define glLineStipple
Definition gl.h:4213
#define glPopAttrib
Definition gl.h:4477
#define glLineWidth
Definition gl.h:4215
#define glPushAttrib
Definition gl.h:4597
#define glDisable
Definition gl.h:3607
coord_t width(const BoundingBox &box)
Definition Arrange.cpp:1184
coord_t height(const BoundingBox &box)
Definition Arrange.cpp:1185
Eigen::Matrix< float, 4, 1, Eigen::DontAlign > Vec4f
Definition Point.hpp:66
Eigen::Matrix< float, 2, 1, Eigen::DontAlign > Vec2f
Definition Point.hpp:64
Eigen::Matrix< double, 2, 1, Eigen::DontAlign > Vec2d
Definition Point.hpp:67
@ right
Definition MarchingSquares.hpp:190
@ left
Definition MarchingSquares.hpp:188
@ P2
Definition GLModel.hpp:42
@ P4
Definition GLModel.hpp:48
@ LineLoop
Definition GLModel.hpp:37
@ Lines
Definition GLModel.hpp:35