From 846afdf7f3e9148fa36133c4c9d1d138930055a4 Mon Sep 17 00:00:00 2001 From: Lukas Matena Date: Fri, 9 Apr 2021 20:43:21 +0200 Subject: [PATCH] Removed last GLU call, removed libGLU from CMakeLists --- src/slic3r/CMakeLists.txt | 2 +- src/slic3r/GUI/Selection.cpp | 20 +++++++------------- src/slic3r/GUI/Selection.hpp | 10 +--------- 3 files changed, 9 insertions(+), 23 deletions(-) diff --git a/src/slic3r/CMakeLists.txt b/src/slic3r/CMakeLists.txt index aa3bf01c4..caccec5d7 100644 --- a/src/slic3r/CMakeLists.txt +++ b/src/slic3r/CMakeLists.txt @@ -240,7 +240,7 @@ add_library(libslic3r_gui STATIC ${SLIC3R_GUI_SOURCES}) encoding_check(libslic3r_gui) -target_link_libraries(libslic3r_gui libslic3r avrdude cereal imgui GLEW::GLEW OpenGL::GL OpenGL::GLU hidapi libcurl ${wxWidgets_LIBRARIES}) +target_link_libraries(libslic3r_gui libslic3r avrdude cereal imgui GLEW::GLEW OpenGL::GL hidapi libcurl ${wxWidgets_LIBRARIES}) if (CMAKE_SYSTEM_NAME STREQUAL "Linux") target_link_libraries(libslic3r_gui ${DBUS_LIBRARIES}) diff --git a/src/slic3r/GUI/Selection.cpp b/src/slic3r/GUI/Selection.cpp index 5c34d7de0..5fe6c2c17 100644 --- a/src/slic3r/GUI/Selection.cpp +++ b/src/slic3r/GUI/Selection.cpp @@ -115,20 +115,8 @@ Selection::Selection() , m_scale_factor(1.0f) { this->set_bounding_boxes_dirty(); -#if ENABLE_RENDER_SELECTION_CENTER - m_quadric = ::gluNewQuadric(); - if (m_quadric != nullptr) - ::gluQuadricDrawStyle(m_quadric, GLU_FILL); -#endif // ENABLE_RENDER_SELECTION_CENTER } -#if ENABLE_RENDER_SELECTION_CENTER -Selection::~Selection() -{ - if (m_quadric != nullptr) - ::gluDeleteQuadric(m_quadric); -} -#endif // ENABLE_RENDER_SELECTION_CENTER void Selection::set_volumes(GLVolumePtrs* volumes) { @@ -141,6 +129,11 @@ bool Selection::init() { m_arrow.init_from(straight_arrow(10.0f, 5.0f, 5.0f, 10.0f, 1.0f)); m_curved_arrow.init_from(circular_arrow(16, 10.0f, 5.0f, 10.0f, 5.0f, 1.0f)); + +#if ENABLE_RENDER_SELECTION_CENTER + m_vbo_sphere.init_from(make_sphere(0.75, 2*PI/24)); +#endif // ENABLE_RENDER_SELECTION_CENTER + return true; } @@ -1177,6 +1170,7 @@ void Selection::render(float scale_factor) const void Selection::render_center(bool gizmo_is_dragging) const { if (!m_valid || is_empty() || m_quadric == nullptr) + if (!m_valid || is_empty()) return; const Vec3d center = gizmo_is_dragging ? m_cache.dragging_center : get_bounding_box().center(); @@ -1188,7 +1182,7 @@ void Selection::render_center(bool gizmo_is_dragging) const glsafe(::glColor3f(1.0f, 1.0f, 1.0f)); glsafe(::glPushMatrix()); glsafe(::glTranslated(center(0), center(1), center(2))); - glsafe(::gluSphere(m_quadric, 0.75, 32, 32)); + m_vbo_sphere.render(); glsafe(::glPopMatrix()); glsafe(::glDisable(GL_LIGHTING)); diff --git a/src/slic3r/GUI/Selection.hpp b/src/slic3r/GUI/Selection.hpp index c28a6e867..ae82f9ca7 100644 --- a/src/slic3r/GUI/Selection.hpp +++ b/src/slic3r/GUI/Selection.hpp @@ -5,11 +5,6 @@ #include "libslic3r/Geometry.hpp" #include "GLModel.hpp" -#if ENABLE_RENDER_SELECTION_CENTER -class GLUquadric; -typedef class GLUquadric GLUquadricObj; -#endif // ENABLE_RENDER_SELECTION_CENTER - namespace Slic3r { class Shader; @@ -216,7 +211,7 @@ private: bool m_scaled_instance_bounding_box_dirty; #if ENABLE_RENDER_SELECTION_CENTER - GLUquadricObj* m_quadric; + GLModel m_vbo_sphere; #endif // ENABLE_RENDER_SELECTION_CENTER GLModel m_arrow; @@ -226,9 +221,6 @@ private: public: Selection(); -#if ENABLE_RENDER_SELECTION_CENTER - ~Selection(); -#endif // ENABLE_RENDER_SELECTION_CENTER void set_volumes(GLVolumePtrs* volumes); bool init();