diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp index d8912b7647..d9a396ba10 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.cpp @@ -913,10 +913,6 @@ void GLMmSegmentationGizmo3DScene::release_geometry() { glsafe(::glDeleteBuffers(1, &triangle_indices_VBO_id)); triangle_indices_VBO_id = 0; } - if (this->vertices_VAO_id) { - glsafe(::glDeleteVertexArrays(1, &this->vertices_VAO_id)); - this->vertices_VAO_id = 0; - } this->clear(); } @@ -933,7 +929,6 @@ void GLMmSegmentationGizmo3DScene::render(size_t triangle_indices_idx) const if (shader == nullptr) return; - glsafe(::glBindVertexArray(this->vertices_VAO_id)); // the following binding is needed to set the vertex attributes glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->vertices_VBO_id)); const GLint position_id = shader->get_attrib_location("v_position"); @@ -954,7 +949,6 @@ void GLMmSegmentationGizmo3DScene::render(size_t triangle_indices_idx) const glsafe(::glDisableVertexAttribArray(position_id)); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0)); - glsafe(::glBindVertexArray(0)); } void GLMmSegmentationGizmo3DScene::finalize_vertices() @@ -962,16 +956,11 @@ void GLMmSegmentationGizmo3DScene::finalize_vertices() assert(this->vertices_VAO_id == 0); assert(this->vertices_VBO_id == 0); if (!this->vertices.empty()) { - glsafe(::glGenVertexArrays(1, &this->vertices_VAO_id)); - glsafe(::glBindVertexArray(this->vertices_VAO_id)); - glsafe(::glGenBuffers(1, &this->vertices_VBO_id)); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->vertices_VBO_id)); glsafe(::glBufferData(GL_ARRAY_BUFFER, this->vertices.size() * sizeof(float), this->vertices.data(), GL_STATIC_DRAW)); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0)); this->vertices.clear(); - - glsafe(::glBindVertexArray(0)); } } diff --git a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp index 0343c6c324..d816735c68 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoMmuSegmentation.hpp @@ -57,7 +57,6 @@ public: // IDs of the Vertex Array Objects, into which the geometry has been loaded. // Zero if the VBOs are not sent to GPU yet. - unsigned int vertices_VAO_id{ 0 }; unsigned int vertices_VBO_id{0}; std::vector triangle_indices_VBO_ids; }; diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp index 8b33edfcb8..6bf8a526ab 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.cpp @@ -1508,7 +1508,6 @@ void TriangleSelectorPatch::render(int triangle_indices_idx) if (shader == nullptr) return; - glsafe(::glBindVertexArray(this->m_vertices_VAO_ids[triangle_indices_idx])); // the following binding is needed to set the vertex attributes glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->m_vertices_VBO_ids[triangle_indices_idx])); const GLint position_id = shader->get_attrib_location("v_position"); @@ -1529,7 +1528,6 @@ void TriangleSelectorPatch::render(int triangle_indices_idx) glsafe(::glDisableVertexAttribArray(position_id)); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0)); - glsafe(::glBindVertexArray(0)); } void TriangleSelectorPatch::release_geometry() @@ -1542,10 +1540,6 @@ void TriangleSelectorPatch::release_geometry() glsafe(::glDeleteBuffers(1, &vertice_VBO_id)); vertice_VBO_id = 0; } - for (auto &vertice_VAO_id : m_vertices_VAO_ids) { - glsafe(::glDeleteVertexArrays(1, &vertice_VAO_id)); - vertice_VAO_id = 0; - } for (auto& triangle_indices_VBO_id : m_triangle_indices_VBO_ids) { glsafe(::glDeleteBuffers(1, &triangle_indices_VBO_id)); triangle_indices_VBO_id = 0; @@ -1570,7 +1564,6 @@ void TriangleSelectorPatch::finalize_vertices() void TriangleSelectorPatch::finalize_triangle_indices() { m_vertices_VBO_ids.resize(m_triangle_patches.size()); - m_vertices_VAO_ids.resize(m_triangle_patches.size()); m_triangle_indices_VBO_ids.resize(m_triangle_patches.size()); m_triangle_indices_sizes.resize(m_triangle_patches.size()); assert(std::all_of(m_triangle_indices_VBO_ids.cbegin(), m_triangle_indices_VBO_ids.cend(), [](const auto& ti_VBO_id) { return ti_VBO_id == 0; })); @@ -1578,9 +1571,6 @@ void TriangleSelectorPatch::finalize_triangle_indices() for (size_t buffer_idx = 0; buffer_idx < m_triangle_patches.size(); ++buffer_idx) { std::vector& patch_vertices = m_triangle_patches[buffer_idx].patch_vertices; if (!patch_vertices.empty()) { - glsafe(::glGenVertexArrays(1, &m_vertices_VAO_ids[buffer_idx])); - glsafe(::glBindVertexArray(m_vertices_VAO_ids[buffer_idx])); - glsafe(::glGenBuffers(1, &m_vertices_VBO_ids[buffer_idx])); glsafe(::glBindBuffer(GL_ARRAY_BUFFER, m_vertices_VBO_ids[buffer_idx])); glsafe(::glBufferData(GL_ARRAY_BUFFER, patch_vertices.size() * sizeof(float), patch_vertices.data(), GL_STATIC_DRAW)); @@ -1599,7 +1589,6 @@ void TriangleSelectorPatch::finalize_triangle_indices() //BOOST_LOG_TRIVIAL(info) << __FUNCTION__ << boost::format(", Line %1%: buffer_idx %2%, vertices size %3%, buffer id %4%")%__LINE__%buffer_idx%triangle_indices.size()%m_triangle_indices_VBO_ids[buffer_idx]; triangle_indices.clear(); } - glsafe(::glBindVertexArray(0)); } } diff --git a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp index 4252ae7e0a..4ea9412ffa 100644 --- a/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp +++ b/src/slic3r/GUI/Gizmos/GLGizmoPainterBase.hpp @@ -138,7 +138,6 @@ protected: void clear() { // BBS - this->m_vertices_VAO_ids.clear(); this->m_vertices_VBO_ids.clear(); this->m_triangle_indices_VBO_ids.clear(); this->m_triangle_indices_sizes.clear(); @@ -167,7 +166,6 @@ protected: // IDs of the Vertex Array Objects, into which the geometry has been loaded. // Zero if the VBOs are not sent to GPU yet. //unsigned int m_vertices_VBO_id{ 0 }; - std::vector m_vertices_VAO_ids; std::vector m_vertices_VBO_ids; std::vector m_triangle_indices_VBO_ids;