Tech ENABLE_GL_CORE_PROFILE - Use thick_lines shader where needed
Fixed conflicts during rebase with master
This commit is contained in:
parent
389dc36053
commit
017784c38e
14 changed files with 142 additions and 20 deletions
|
@ -2,7 +2,7 @@
|
|||
|
||||
// see as reference: https://github.com/mhalber/Lines/blob/master/geometry_shader_lines.h
|
||||
|
||||
const vec2 aa_radius = vec2(1.5);
|
||||
const vec2 aa_radius = vec2(1.0);
|
||||
|
||||
uniform vec4 uniform_color;
|
||||
|
|
@ -5,7 +5,7 @@
|
|||
layout(lines) in;
|
||||
layout(triangle_strip, max_vertices = 4) out;
|
||||
|
||||
const vec2 aa_radius = vec2(1.5);
|
||||
const vec2 aa_radius = vec2(1.0);
|
||||
|
||||
uniform vec2 viewport_size;
|
||||
uniform float width;
|
||||
|
@ -20,10 +20,10 @@ void main()
|
|||
float u_height = viewport_size[1];
|
||||
float u_aspect_ratio = u_height / u_width;
|
||||
|
||||
vec2 ndc_a = gl_in[0].gl_Position.xy / gl_in[0].gl_Position.w;
|
||||
vec2 ndc_b = gl_in[1].gl_Position.xy / gl_in[1].gl_Position.w;
|
||||
vec2 ndc_0 = gl_in[0].gl_Position.xy / gl_in[0].gl_Position.w;
|
||||
vec2 ndc_1 = gl_in[1].gl_Position.xy / gl_in[1].gl_Position.w;
|
||||
|
||||
vec2 line_vector = ndc_b - ndc_a;
|
||||
vec2 line_vector = ndc_1 - ndc_0;
|
||||
vec2 viewport_line_vector = line_vector * viewport_size;
|
||||
vec2 dir = normalize(viewport_line_vector);
|
||||
vec2 normal_dir = vec2(-dir.y, dir.x);
|
||||
|
@ -38,19 +38,19 @@ void main()
|
|||
float half_line_length = line_length * 0.5;
|
||||
|
||||
uv = vec2(-half_line_width, half_line_length);
|
||||
gl_Position = vec4((ndc_a + normal - extension) * gl_in[0].gl_Position.w, gl_in[0].gl_Position.zw);
|
||||
gl_Position = vec4((ndc_0 + normal - extension) * gl_in[0].gl_Position.w, gl_in[0].gl_Position.zw);
|
||||
EmitVertex();
|
||||
|
||||
uv = vec2(-half_line_width, -half_line_length);
|
||||
gl_Position = vec4((ndc_a - normal - extension) * gl_in[0].gl_Position.w, gl_in[0].gl_Position.zw);
|
||||
gl_Position = vec4((ndc_0 - normal - extension) * gl_in[0].gl_Position.w, gl_in[0].gl_Position.zw);
|
||||
EmitVertex();
|
||||
|
||||
uv = vec2(half_line_width, half_line_length);
|
||||
gl_Position = vec4((ndc_b + normal + extension) * gl_in[1].gl_Position.w, gl_in[1].gl_Position.zw);
|
||||
gl_Position = vec4((ndc_1 + normal + extension) * gl_in[1].gl_Position.w, gl_in[1].gl_Position.zw);
|
||||
EmitVertex();
|
||||
|
||||
uv = vec2(half_line_width, -half_line_length);
|
||||
gl_Position = vec4((ndc_b - normal + extension) * gl_in[1].gl_Position.w, gl_in[1].gl_Position.zw);
|
||||
gl_Position = vec4((ndc_1 - normal + extension) * gl_in[1].gl_Position.w, gl_in[1].gl_Position.zw);
|
||||
EmitVertex();
|
||||
|
||||
EndPrimitive();
|
|
@ -403,7 +403,7 @@ void GLVolume::NonManifoldEdges::render()
|
|||
#if ENABLE_GL_CORE_PROFILE
|
||||
const std::array<int, 4>& viewport = camera.get_viewport();
|
||||
shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
|
||||
shader->set_uniform("width", 1.5f);
|
||||
shader->set_uniform("width", 0.5f);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
#else
|
||||
glsafe(::glPushMatrix());
|
||||
|
@ -1094,7 +1094,7 @@ void GLVolumeCollection::render(GLVolumeCollection::ERenderType type, bool disab
|
|||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
GLShaderProgram* sink_shader = GUI::wxGetApp().get_shader("flat");
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
GLShaderProgram* edges_shader = GUI::wxGetApp().get_shader("lines_width");
|
||||
GLShaderProgram* edges_shader = GUI::wxGetApp().get_shader("thick_lines");
|
||||
#else
|
||||
GLShaderProgram* edges_shader = GUI::wxGetApp().get_shader("flat");
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
|
|
@ -736,7 +736,7 @@ void GCodeViewer::init()
|
|||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
buffer.vertices.format = VBuffer::EFormat::Position;
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
buffer.shader = "lines_width";
|
||||
buffer.shader = "thick_lines";
|
||||
#else
|
||||
buffer.shader = "flat";
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
|
|
@ -6120,7 +6120,7 @@ void GLCanvas3D::_render_camera_target()
|
|||
}
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("lines_width");
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("thick_lines");
|
||||
#else
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("flat");
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
|
|
@ -135,7 +135,11 @@ namespace GUI {
|
|||
#endif // !ENABLE_GL_CORE_PROFILE
|
||||
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("thick_lines");
|
||||
#else
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("flat");
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
|
||||
|
@ -167,6 +171,11 @@ namespace GUI {
|
|||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
shader->set_uniform("view_model_matrix", Transform3d::Identity());
|
||||
shader->set_uniform("projection_matrix", Transform3d::Identity());
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
const std::array<int, 4>& viewport = wxGetApp().plater()->get_camera().get_viewport();
|
||||
shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
|
||||
shader->set_uniform("width", 0.25f);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
|
||||
m_rectangle.set_color(ColorRGBA((m_state == EState::Select) ? 0.3f : 1.0f, (m_state == EState::Select) ? 1.0f : 0.3f, 0.3f, 1.0f));
|
||||
|
|
|
@ -48,7 +48,7 @@ std::pair<bool, std::string> GLShadersManager::init()
|
|||
valid &= append_shader("background", { prefix + "background.vs", prefix + "background.fs" });
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
// used to render thick lines
|
||||
valid &= append_shader("lines_width", { prefix + "lines_width.vs", prefix + "lines_width.fs", prefix + "lines_width.gs" });
|
||||
valid &= append_shader("thick_lines", { prefix + "thick_lines.vs", prefix + "thick_lines.fs", prefix + "thick_lines.gs" });
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
#else
|
||||
// basic shader, used to render all what was previously rendered using the immediate mode
|
||||
|
|
|
@ -107,15 +107,24 @@ void GLGizmoCut::on_render()
|
|||
glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
|
||||
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
const Vec3d diff = plane_center - m_old_center;
|
||||
// Z changed when move with cut plane
|
||||
// X and Y changed when move with cutted object
|
||||
bool is_changed = std::abs(diff.x()) > EPSILON || std::abs(diff.y()) > EPSILON || std::abs(diff.z()) > EPSILON;
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("flat");
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
#if !ENABLE_GL_CORE_PROFILE
|
||||
const Vec3d diff = plane_center - m_old_center;
|
||||
// Z changed when move with cut plane
|
||||
// X and Y changed when move with cutted object
|
||||
bool is_changed = std::abs(diff.x()) > EPSILON ||
|
||||
std::abs(diff.y()) > EPSILON ||
|
||||
std::abs(diff.z()) > EPSILON;
|
||||
std::abs(diff.y()) > EPSILON ||
|
||||
std::abs(diff.z()) > EPSILON;
|
||||
#endif // !ENABLE_GL_CORE_PROFILE
|
||||
m_old_center = plane_center;
|
||||
|
||||
if (!m_plane.is_initialized() || is_changed) {
|
||||
|
@ -123,7 +132,7 @@ void GLGizmoCut::on_render()
|
|||
|
||||
GLModel::Geometry init_data;
|
||||
init_data.format = { GLModel::Geometry::EPrimitiveType::Triangles, GLModel::Geometry::EVertexLayout::P3 };
|
||||
init_data.color = { 0.8f, 0.8f, 0.8f, 0.5f };
|
||||
init_data.color = { 0.8f, 0.8f, 0.8f, 0.5f };
|
||||
init_data.reserve_vertices(4);
|
||||
init_data.reserve_indices(6);
|
||||
|
||||
|
@ -158,6 +167,22 @@ void GLGizmoCut::on_render()
|
|||
glsafe(::glEnd());
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
shader->stop_using();
|
||||
}
|
||||
|
||||
shader = wxGetApp().get_shader("thick_lines");
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
|
||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||
const std::array<int, 4>& viewport = camera.get_viewport();
|
||||
shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
|
||||
shader->set_uniform("width", 0.5f);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
||||
glsafe(::glEnable(GL_CULL_FACE));
|
||||
glsafe(::glDisable(GL_BLEND));
|
||||
|
||||
|
@ -192,6 +217,11 @@ void GLGizmoCut::on_render()
|
|||
|
||||
m_grabber_connection.render();
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix()* Geometry::assemble_transform(m_cut_contours.shift));
|
||||
m_cut_contours.contours.render();
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
||||
shader->stop_using();
|
||||
}
|
||||
|
||||
|
@ -215,6 +245,7 @@ void GLGizmoCut::on_render()
|
|||
shader->stop_using();
|
||||
}
|
||||
|
||||
#if !ENABLE_GL_CORE_PROFILE
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
shader = wxGetApp().get_shader("flat");
|
||||
if (shader != nullptr) {
|
||||
|
@ -239,7 +270,8 @@ void GLGizmoCut::on_render()
|
|||
shader->stop_using();
|
||||
}
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
}
|
||||
#endif // !ENABLE_GL_CORE_PROFILE
|
||||
}
|
||||
|
||||
void GLGizmoCut::on_render_for_picking()
|
||||
{
|
||||
|
|
|
@ -166,7 +166,11 @@ void GLGizmoMove3D::on_render()
|
|||
|
||||
if (m_hover_id == -1) {
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("thick_lines");
|
||||
#else
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("flat");
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
|
@ -175,6 +179,11 @@ void GLGizmoMove3D::on_render()
|
|||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
const std::array<int, 4>& viewport = camera.get_viewport();
|
||||
shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
|
||||
shader->set_uniform("width", 0.25f);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
|
||||
// draw axes
|
||||
|
@ -209,7 +218,11 @@ void GLGizmoMove3D::on_render()
|
|||
else {
|
||||
// draw axis
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("thick_lines");
|
||||
#else
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("flat");
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
|
||||
|
@ -217,6 +230,11 @@ void GLGizmoMove3D::on_render()
|
|||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
const std::array<int, 4>& viewport = camera.get_viewport();
|
||||
shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
|
||||
shader->set_uniform("width", 0.5f);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
|
||||
render_grabber_connection(m_hover_id);
|
||||
|
|
|
@ -251,12 +251,21 @@ void GLGizmoPainterBase::render_cursor_circle()
|
|||
m_circle.init_from(std::move(init_data));
|
||||
}
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("thick_lines");
|
||||
#else
|
||||
GLShaderProgram* shader = GUI::wxGetApp().get_shader("flat");
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
shader->set_uniform("view_model_matrix", Transform3d::Identity());
|
||||
shader->set_uniform("projection_matrix", Transform3d::Identity());
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
const std::array<int, 4>& viewport = wxGetApp().plater()->get_camera().get_viewport();
|
||||
shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
|
||||
shader->set_uniform("width", 0.25f);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
m_circle.render();
|
||||
shader->stop_using();
|
||||
|
|
|
@ -179,7 +179,11 @@ void GLGizmoRotate::on_render()
|
|||
glsafe(::glLineWidth((m_hover_id != -1) ? 2.0f : 1.5f));
|
||||
#endif // !ENABLE_GL_CORE_PROFILE
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("thick_lines");
|
||||
#else
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("flat");
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
|
||||
|
@ -188,12 +192,17 @@ void GLGizmoRotate::on_render()
|
|||
const Transform3d view_model_matrix = camera.get_view_matrix() * m_grabbers.front().matrix;
|
||||
shader->set_uniform("view_model_matrix", view_model_matrix);
|
||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
const std::array<int, 4>& viewport = camera.get_viewport();
|
||||
shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
|
||||
shader->set_uniform("width", 0.25f);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
|
||||
const bool radius_changed = std::abs(m_old_radius - m_radius) > EPSILON;
|
||||
m_old_radius = m_radius;
|
||||
|
||||
ColorRGBA color((m_hover_id != -1) ? m_drag_color : m_highlight_color);
|
||||
const ColorRGBA color = (m_hover_id != -1) ? m_drag_color : m_highlight_color;
|
||||
render_circle(color, radius_changed);
|
||||
if (m_hover_id != -1) {
|
||||
const bool hover_radius_changed = std::abs(m_old_hover_radius - m_radius) > EPSILON;
|
||||
|
|
|
@ -267,13 +267,22 @@ void GLGizmoScale3D::on_render()
|
|||
if (m_hover_id == -1) {
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
// draw connections
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("thick_lines");
|
||||
#else
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("flat");
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
const std::array<int, 4>& viewport = camera.get_viewport();
|
||||
shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
|
||||
shader->set_uniform("width", 0.25f);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
if (m_grabbers[0].enabled && m_grabbers[1].enabled)
|
||||
render_grabbers_connection(0, 1, m_grabbers[0].color);
|
||||
|
@ -314,13 +323,22 @@ void GLGizmoScale3D::on_render()
|
|||
else if (m_hover_id == 0 || m_hover_id == 1) {
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
// draw connections
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("thick_lines");
|
||||
#else
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("flat");
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
const std::array<int, 4>& viewport = camera.get_viewport();
|
||||
shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
|
||||
shader->set_uniform("width", 0.25f);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
render_grabbers_connection(0, 1, m_grabbers[0].color);
|
||||
shader->stop_using();
|
||||
|
@ -347,13 +365,22 @@ void GLGizmoScale3D::on_render()
|
|||
else if (m_hover_id == 2 || m_hover_id == 3) {
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
// draw connections
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("thick_lines");
|
||||
#else
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("flat");
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
const std::array<int, 4>& viewport = camera.get_viewport();
|
||||
shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
|
||||
shader->set_uniform("width", 0.25f);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
render_grabbers_connection(2, 3, m_grabbers[2].color);
|
||||
shader->stop_using();
|
||||
|
@ -380,13 +407,22 @@ void GLGizmoScale3D::on_render()
|
|||
else if (m_hover_id == 4 || m_hover_id == 5) {
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
// draw connections
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("thick_lines");
|
||||
#else
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("flat");
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
const std::array<int, 4>& viewport = camera.get_viewport();
|
||||
shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
|
||||
shader->set_uniform("width", 0.25f);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
render_grabbers_connection(4, 5, m_grabbers[4].color);
|
||||
shader->stop_using();
|
||||
|
@ -413,13 +449,22 @@ void GLGizmoScale3D::on_render()
|
|||
else if (m_hover_id >= 6) {
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
// draw connections
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("thick_lines");
|
||||
#else
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("flat");
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
if (shader != nullptr) {
|
||||
shader->start_using();
|
||||
#if ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
const Camera& camera = wxGetApp().plater()->get_camera();
|
||||
shader->set_uniform("view_model_matrix", camera.get_view_matrix());
|
||||
shader->set_uniform("projection_matrix", camera.get_projection_matrix());
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
const std::array<int, 4>& viewport = camera.get_viewport();
|
||||
shader->set_uniform("viewport_size", Vec2d(double(viewport[2]), double(viewport[3])));
|
||||
shader->set_uniform("width", 0.25f);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
#endif // ENABLE_GL_SHADERS_ATTRIBUTES
|
||||
render_grabbers_connection(6, 7, m_drag_color);
|
||||
render_grabbers_connection(7, 8, m_drag_color);
|
||||
|
|
|
@ -2014,7 +2014,7 @@ void Selection::render_bounding_box(const BoundingBoxf3 & box, float* color) con
|
|||
glsafe(::glEnable(GL_DEPTH_TEST));
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("lines_width");
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("thick_lines");
|
||||
#else
|
||||
glsafe(::glLineWidth(2.0f * m_scale_factor));
|
||||
GLShaderProgram* shader = wxGetApp().get_shader("flat");
|
||||
|
|
Loading…
Reference in a new issue