mirror of
https://git.mirrors.martin98.com/https://github.com/prusa3d/PrusaSlicer.git
synced 2025-08-14 00:26:01 +08:00
Tech ENABLE_GL_CORE_PROFILE - Fixed rendering of GLMmSegmentationGizmo3DScene
Fixed conflicts during rebase with master
This commit is contained in:
parent
41541287a1
commit
106b666e18
@ -706,6 +706,13 @@ void GLMmSegmentationGizmo3DScene::release_geometry() {
|
||||
glsafe(::glDeleteBuffers(1, &triangle_indices_VBO_id));
|
||||
triangle_indices_VBO_id = 0;
|
||||
}
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
if (this->vertices_VAO_id) {
|
||||
glsafe(::glDeleteVertexArrays(1, &this->vertices_VAO_id));
|
||||
this->vertices_VAO_id = 0;
|
||||
}
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
||||
this->clear();
|
||||
}
|
||||
|
||||
@ -713,6 +720,9 @@ void GLMmSegmentationGizmo3DScene::render(size_t triangle_indices_idx) const
|
||||
{
|
||||
assert(triangle_indices_idx < this->triangle_indices_VBO_ids.size());
|
||||
assert(this->triangle_indices_sizes.size() == this->triangle_indices_VBO_ids.size());
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
assert(this->vertices_VAO_id != 0);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
assert(this->vertices_VBO_id != 0);
|
||||
assert(this->triangle_indices_VBO_ids[triangle_indices_idx] != 0);
|
||||
|
||||
@ -722,6 +732,10 @@ void GLMmSegmentationGizmo3DScene::render(size_t triangle_indices_idx) const
|
||||
return;
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
glsafe(::glBindVertexArray(this->vertices_VAO_id));
|
||||
// the following binding is needed to set the vertex attributes
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, this->vertices_VBO_id));
|
||||
#if ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
const GLint position_id = shader->get_attrib_location("v_position");
|
||||
@ -753,17 +767,32 @@ void GLMmSegmentationGizmo3DScene::render(size_t triangle_indices_idx) const
|
||||
#endif // ENABLE_LEGACY_OPENGL_REMOVAL
|
||||
|
||||
glsafe(::glBindBuffer(GL_ARRAY_BUFFER, 0));
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
glsafe(::glBindVertexArray(0));
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
}
|
||||
|
||||
void GLMmSegmentationGizmo3DScene::finalize_vertices()
|
||||
{
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
assert(this->vertices_VAO_id == 0);
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
assert(this->vertices_VBO_id == 0);
|
||||
if (!this->vertices.empty()) {
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
glsafe(::glGenVertexArrays(1, &this->vertices_VAO_id));
|
||||
glsafe(::glBindVertexArray(this->vertices_VAO_id));
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
|
||||
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();
|
||||
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
glsafe(::glBindVertexArray(0));
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -55,7 +55,10 @@ 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_VBO_id{0};
|
||||
#if ENABLE_GL_CORE_PROFILE
|
||||
unsigned int vertices_VAO_id{ 0 };
|
||||
#endif // ENABLE_GL_CORE_PROFILE
|
||||
unsigned int vertices_VBO_id{ 0 };
|
||||
std::vector<unsigned int> triangle_indices_VBO_ids;
|
||||
};
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user