Fix image projection 2d preview. Show models with image texture properly when opening true color painting panel

This commit is contained in:
sentientstardust
2026-05-03 19:55:58 +01:00
parent 770358653a
commit 6e0a3486a2
2 changed files with 28 additions and 19 deletions

View File

@@ -7348,6 +7348,13 @@ bool GLGizmoImageProjection::ensure_overlay_texture()
m_image_error = _u8L("Unable to display the selected image.");
return false;
}
glsafe(::glBindTexture(GL_TEXTURE_2D, m_overlay_texture.get_id()));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR));
glsafe(::glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAX_LEVEL, 0));
glsafe(::glBindTexture(GL_TEXTURE_2D, 0));
m_overlay_texture_dirty = false;
return true;
}

View File

@@ -1696,26 +1696,28 @@ void TriangleSelectorPatch::update_render_data()
m_vertex_color_preview_colors,
m_vertex_color_preview_filament_ids,
m_texture_mapping_color_preview);
} else if (model_volume_has_texture_preview_data_for_painting(*m_model_volume)) {
build_mmu_texture_preview_models(*m_model_volume,
triangles_per_type,
m_ebt_colors,
m_model_volume->extruder_id() > 0 ? unsigned(m_model_volume->extruder_id()) : 0u,
num_physical,
texture_mgr,
m_texture_preview_models,
m_texture_preview_colors,
m_texture_preview_filament_ids);
} else {
if (model_volume_has_texture_preview_data_for_painting(*m_model_volume)) {
build_mmu_texture_preview_models(*m_model_volume,
triangles_per_type,
m_ebt_colors,
m_model_volume->extruder_id() > 0 ? unsigned(m_model_volume->extruder_id()) : 0u,
num_physical,
texture_mgr,
m_texture_preview_models,
m_texture_preview_colors,
m_texture_preview_filament_ids);
}
build_mmu_vertex_color_preview_models(*m_model_volume,
triangles_per_type,
m_ebt_colors,
m_model_volume->extruder_id() > 0 ? unsigned(m_model_volume->extruder_id()) : 0u,
num_physical,
texture_mgr,
m_vertex_color_preview_models,
m_vertex_color_preview_colors,
m_vertex_color_preview_filament_ids);
}
build_mmu_vertex_color_preview_models(*m_model_volume,
triangles_per_type,
m_ebt_colors,
m_model_volume->extruder_id() > 0 ? unsigned(m_model_volume->extruder_id()) : 0u,
num_physical,
texture_mgr,
m_vertex_color_preview_models,
m_vertex_color_preview_colors,
m_vertex_color_preview_filament_ids);
}
m_paint_changed = false;