mirror of
https://github.com/SoftFever/OrcaSlicer.git
synced 2025-07-19 12:47:50 -06:00
Fix painter gizmos crash on macOS
This commit is contained in:
parent
28e2995a01
commit
e57f68a266
4 changed files with 0 additions and 25 deletions
|
@ -913,10 +913,6 @@ void GLMmSegmentationGizmo3DScene::release_geometry() {
|
||||||
glsafe(::glDeleteBuffers(1, &triangle_indices_VBO_id));
|
glsafe(::glDeleteBuffers(1, &triangle_indices_VBO_id));
|
||||||
triangle_indices_VBO_id = 0;
|
triangle_indices_VBO_id = 0;
|
||||||
}
|
}
|
||||||
if (this->vertices_VAO_id) {
|
|
||||||
glsafe(::glDeleteVertexArrays(1, &this->vertices_VAO_id));
|
|
||||||
this->vertices_VAO_id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
this->clear();
|
this->clear();
|
||||||
}
|
}
|
||||||
|
@ -933,7 +929,6 @@ void GLMmSegmentationGizmo3DScene::render(size_t triangle_indices_idx) const
|
||||||
if (shader == nullptr)
|
if (shader == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
glsafe(::glBindVertexArray(this->vertices_VAO_id));
|
|
||||||
// the following binding is needed to set the vertex attributes
|
// the following binding is needed to set the vertex attributes
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->vertices_VBO_id));
|
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->vertices_VBO_id));
|
||||||
const GLint position_id = shader->get_attrib_location("v_position");
|
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(::glDisableVertexAttribArray(position_id));
|
||||||
|
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
||||||
glsafe(::glBindVertexArray(0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void GLMmSegmentationGizmo3DScene::finalize_vertices()
|
void GLMmSegmentationGizmo3DScene::finalize_vertices()
|
||||||
|
@ -962,16 +956,11 @@ void GLMmSegmentationGizmo3DScene::finalize_vertices()
|
||||||
assert(this->vertices_VAO_id == 0);
|
assert(this->vertices_VAO_id == 0);
|
||||||
assert(this->vertices_VBO_id == 0);
|
assert(this->vertices_VBO_id == 0);
|
||||||
if (!this->vertices.empty()) {
|
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(::glGenBuffers(1, &this->vertices_VBO_id));
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 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(::glBufferData(GL_ARRAY_BUFFER, this->vertices.size() * sizeof(float), this->vertices.data(), GL_STATIC_DRAW));
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
||||||
this->vertices.clear();
|
this->vertices.clear();
|
||||||
|
|
||||||
glsafe(::glBindVertexArray(0));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,6 @@ public:
|
||||||
|
|
||||||
// IDs of the Vertex Array Objects, into which the geometry has been loaded.
|
// IDs of the Vertex Array Objects, into which the geometry has been loaded.
|
||||||
// Zero if the VBOs are not sent to GPU yet.
|
// Zero if the VBOs are not sent to GPU yet.
|
||||||
unsigned int vertices_VAO_id{ 0 };
|
|
||||||
unsigned int vertices_VBO_id{0};
|
unsigned int vertices_VBO_id{0};
|
||||||
std::vector<unsigned int> triangle_indices_VBO_ids;
|
std::vector<unsigned int> triangle_indices_VBO_ids;
|
||||||
};
|
};
|
||||||
|
|
|
@ -1508,7 +1508,6 @@ void TriangleSelectorPatch::render(int triangle_indices_idx)
|
||||||
if (shader == nullptr)
|
if (shader == nullptr)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
glsafe(::glBindVertexArray(this->m_vertices_VAO_ids[triangle_indices_idx]));
|
|
||||||
// the following binding is needed to set the vertex attributes
|
// the following binding is needed to set the vertex attributes
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->m_vertices_VBO_ids[triangle_indices_idx]));
|
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->m_vertices_VBO_ids[triangle_indices_idx]));
|
||||||
const GLint position_id = shader->get_attrib_location("v_position");
|
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(::glDisableVertexAttribArray(position_id));
|
||||||
|
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
||||||
glsafe(::glBindVertexArray(0));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void TriangleSelectorPatch::release_geometry()
|
void TriangleSelectorPatch::release_geometry()
|
||||||
|
@ -1542,10 +1540,6 @@ void TriangleSelectorPatch::release_geometry()
|
||||||
glsafe(::glDeleteBuffers(1, &vertice_VBO_id));
|
glsafe(::glDeleteBuffers(1, &vertice_VBO_id));
|
||||||
vertice_VBO_id = 0;
|
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) {
|
for (auto& triangle_indices_VBO_id : m_triangle_indices_VBO_ids) {
|
||||||
glsafe(::glDeleteBuffers(1, &triangle_indices_VBO_id));
|
glsafe(::glDeleteBuffers(1, &triangle_indices_VBO_id));
|
||||||
triangle_indices_VBO_id = 0;
|
triangle_indices_VBO_id = 0;
|
||||||
|
@ -1570,7 +1564,6 @@ void TriangleSelectorPatch::finalize_vertices()
|
||||||
void TriangleSelectorPatch::finalize_triangle_indices()
|
void TriangleSelectorPatch::finalize_triangle_indices()
|
||||||
{
|
{
|
||||||
m_vertices_VBO_ids.resize(m_triangle_patches.size());
|
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_VBO_ids.resize(m_triangle_patches.size());
|
||||||
m_triangle_indices_sizes.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; }));
|
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) {
|
for (size_t buffer_idx = 0; buffer_idx < m_triangle_patches.size(); ++buffer_idx) {
|
||||||
std::vector<float>& patch_vertices = m_triangle_patches[buffer_idx].patch_vertices;
|
std::vector<float>& patch_vertices = m_triangle_patches[buffer_idx].patch_vertices;
|
||||||
if (!patch_vertices.empty()) {
|
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(::glGenBuffers(1, &m_vertices_VBO_ids[buffer_idx]));
|
||||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 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));
|
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];
|
//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();
|
triangle_indices.clear();
|
||||||
}
|
}
|
||||||
glsafe(::glBindVertexArray(0));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -138,7 +138,6 @@ protected:
|
||||||
void clear()
|
void clear()
|
||||||
{
|
{
|
||||||
// BBS
|
// BBS
|
||||||
this->m_vertices_VAO_ids.clear();
|
|
||||||
this->m_vertices_VBO_ids.clear();
|
this->m_vertices_VBO_ids.clear();
|
||||||
this->m_triangle_indices_VBO_ids.clear();
|
this->m_triangle_indices_VBO_ids.clear();
|
||||||
this->m_triangle_indices_sizes.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.
|
// IDs of the Vertex Array Objects, into which the geometry has been loaded.
|
||||||
// Zero if the VBOs are not sent to GPU yet.
|
// Zero if the VBOs are not sent to GPU yet.
|
||||||
//unsigned int m_vertices_VBO_id{ 0 };
|
//unsigned int m_vertices_VBO_id{ 0 };
|
||||||
std::vector<unsigned int> m_vertices_VAO_ids;
|
|
||||||
std::vector<unsigned int> m_vertices_VBO_ids;
|
std::vector<unsigned int> m_vertices_VBO_ids;
|
||||||
std::vector<unsigned int> m_triangle_indices_VBO_ids;
|
std::vector<unsigned int> m_triangle_indices_VBO_ids;
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue