Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/prusa3d/PrusaSlicer.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorEnrico Turri <enricoturri@seznam.cz>2019-02-27 12:46:52 +0300
committerEnrico Turri <enricoturri@seznam.cz>2019-02-27 12:46:52 +0300
commit3c39e1a618f3cfcc0a1b37d0f0f5492ef9ab1ea4 (patch)
tree2052e3447d3baaf39004ec18035581159a1bad5c /src
parent6066f7b7c5fa01d74ce62dfbb95fdbb5e00398a6 (diff)
Attempt to fix rendering of printbed svg textures on Mac
Diffstat (limited to 'src')
-rw-r--r--src/slic3r/GUI/3DBed.cpp10
-rw-r--r--src/slic3r/GUI/GLTexture.cpp23
2 files changed, 31 insertions, 2 deletions
diff --git a/src/slic3r/GUI/3DBed.cpp b/src/slic3r/GUI/3DBed.cpp
index d6d25b550..b67bf9eaf 100644
--- a/src/slic3r/GUI/3DBed.cpp
+++ b/src/slic3r/GUI/3DBed.cpp
@@ -556,8 +556,10 @@ void Bed3D::render_prusa(const std::string &key, bool bottom) const
::glGenBuffers(1, &m_vbo_id);
::glBindBuffer(GL_ARRAY_BUFFER, m_vbo_id);
::glBufferData(GL_ARRAY_BUFFER, (GLsizeiptr)m_triangles.get_vertices_data_size(), (const GLvoid*)m_triangles.get_vertices_data(), GL_STATIC_DRAW);
- ::glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, m_triangles.get_vertex_data_size(), (GLvoid*)m_triangles.get_position_offset());
- ::glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, m_triangles.get_vertex_data_size(), (GLvoid*)m_triangles.get_tex_coords_offset());
+//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+// ::glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, m_triangles.get_vertex_data_size(), (GLvoid*)m_triangles.get_position_offset());
+// ::glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, m_triangles.get_vertex_data_size(), (GLvoid*)m_triangles.get_tex_coords_offset());
+//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
::glBindBuffer(GL_ARRAY_BUFFER, 0);
}
@@ -597,6 +599,10 @@ void Bed3D::render_prusa_shader(unsigned int vertices_count, bool transparent) c
::glBindTexture(GL_TEXTURE_2D, (GLuint)m_texture.get_id());
::glBindBuffer(GL_ARRAY_BUFFER, m_vbo_id);
+//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+ ::glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, m_triangles.get_vertex_data_size(), (GLvoid*)m_triangles.get_position_offset());
+ ::glVertexAttribPointer(1, 2, GL_FLOAT, GL_FALSE, m_triangles.get_vertex_data_size(), (GLvoid*)m_triangles.get_tex_coords_offset());
+//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
::glEnableVertexAttribArray(0);
::glEnableVertexAttribArray(1);
::glDrawArrays(GL_TRIANGLES, 0, (GLsizei)vertices_count);
diff --git a/src/slic3r/GUI/GLTexture.cpp b/src/slic3r/GUI/GLTexture.cpp
index e7e20b27e..436a37e1c 100644
--- a/src/slic3r/GUI/GLTexture.cpp
+++ b/src/slic3r/GUI/GLTexture.cpp
@@ -20,6 +20,8 @@
#include "nanosvg/nanosvgrast.h"
#endif // ENABLE_TEXTURES_FROM_SVG
+#include "libslic3r/Utils.hpp"
+
namespace Slic3r {
namespace GUI {
@@ -357,6 +359,27 @@ bool GLTexture::load_from_svg(const std::string& filename, bool use_mipmaps, uns
nsvgDeleteRasterizer(rast);
nsvgDelete(image);
+//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+#if 1
+ // debug output
+ wxImage output(m_width, m_height);
+ output.InitAlpha();
+
+ for (int h = 0; h < m_height; ++h)
+ {
+ int px_h = h * m_width;
+ for (int w = 0; w < m_width; ++w)
+ {
+ int offset = (px_h + w) * 4;
+ output.SetRGB(w, h, data.data()[offset + 0], data.data()[offset + 1], data.data()[offset + 2]);
+ output.SetAlpha(w, h, data.data()[offset + 3]);
+ }
+ }
+
+ output.SaveFile(resources_dir() + "/icons/test_svg_import.png", wxBITMAP_TYPE_PNG);
+#endif // 0
+//@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
+
return true;
}
#endif // ENABLE_TEXTURES_FROM_SVG