FIX: Opaque display after completed slicing

Change-Id: I944f5063ba41b767d01a26052e23bd803425b081
(cherry picked from commit f4d5ef5814c50d8477ac21e58182b00dbb20d6c8)
This commit is contained in:
zhou.xu 2023-06-09 11:23:17 +08:00 committed by Lane.Wei
parent c7ed4e7e14
commit eca3d311d7
5 changed files with 7 additions and 38 deletions

View file

@ -1153,7 +1153,7 @@ void GCodeViewer::refresh(const GCodeProcessorResult& gcode_result, const std::v
}
for (int i = 0; i < m_tools.m_tool_colors.size(); i++) {
m_tools.m_tool_colors[i] = adjust_color_for_rendering(m_tools.m_tool_colors[i], GLCanvas3D::ECanvasType::CanvasPreview);
m_tools.m_tool_colors[i] = adjust_color_for_rendering(m_tools.m_tool_colors[i]);
}
// ensure there are enough colors defined
while (m_tools.m_tool_colors.size() < std::max(size_t(1), gcode_result.extruders_count)) {
@ -3266,7 +3266,7 @@ void GCodeViewer::refresh_render_paths(bool keep_sequential_current_first, bool
color = { 0.5f, 0.5f, 0.5f, 1.0f };
else {
color = m_tools.m_tool_colors[path.cp_color_id];
color = adjust_color_for_rendering(color, GLCanvas3D::ECanvasType::CanvasPreview);
color = adjust_color_for_rendering(color);
}
break;
}
@ -3876,10 +3876,6 @@ void GCodeViewer::render_toolpaths()
](std::vector<RenderPath>::reverse_iterator it_path, std::vector<RenderPath>::reverse_iterator it_end, GLShaderProgram& shader, int uniform_color) {
for (auto it = it_path; it != it_end && it_path->ibuffer_id == it->ibuffer_id; ++it) {
const RenderPath& path = *it;
if (path.color[3] < 1.0) {
glsafe(::glEnable(GL_BLEND));
glsafe(::glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA));
}
// Some OpenGL drivers crash on empty glMultiDrawElements, see GH #7415.
assert(! path.sizes.empty());
assert(! path.offsets.empty());
@ -3888,9 +3884,6 @@ void GCodeViewer::render_toolpaths()
#if ENABLE_GCODE_VIEWER_STATISTICS
++m_statistics.gl_multi_triangles_calls_count;
#endif // ENABLE_GCODE_VIEWER_STATISTICS
if (path.color[3] < 1.0) {
glsafe(::glDisable(GL_BLEND));
}
}
};
@ -4170,7 +4163,7 @@ void GCodeViewer::render_all_plates_stats(const std::vector<const GCodeProcessor
std::vector<Color> filament_colors = decode_colors(wxGetApp().plater()->get_extruder_colors_from_plater_config(gcode_result_list.back()));
for (int i = 0; i < filament_colors.size(); i++) {
filament_colors[i] = adjust_color_for_rendering(filament_colors[i], GLCanvas3D::ECanvasType::CanvasPreview);
filament_colors[i] = adjust_color_for_rendering(filament_colors[i]);
}
bool imperial_units = wxGetApp().app_config->get("use_inches") == "1";