diff options
author | bubnikv <bubnikv@gmail.com> | 2019-08-26 12:12:48 +0300 |
---|---|---|
committer | bubnikv <bubnikv@gmail.com> | 2019-08-26 12:12:48 +0300 |
commit | 85d9a165636617c76d30be54a1cd99bd4e5663b0 (patch) | |
tree | f7e23dc13ed98bb6eef548ba40851e54a33216c4 /src/slic3r/GUI/3DScene.cpp | |
parent | 9cbfe8f5ef6f24ea88f8cdb74dcf866bfd98028d (diff) |
Fixed a bug, where the GL context was not being activated with _set_current()
as _set_current() tested for visibility of the window on the screen.
Improved memory management by:
1) Allocating small (around 3MB) vertex buffers to be sent to the GPU.
2) Passing the small vertex buffers to the GPU as quickly as possible.
A bit of copy / paste refactoring into common functions.
Diffstat (limited to 'src/slic3r/GUI/3DScene.cpp')
-rw-r--r-- | src/slic3r/GUI/3DScene.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/src/slic3r/GUI/3DScene.cpp b/src/slic3r/GUI/3DScene.cpp index d764d6cef..a3d1f0615 100644 --- a/src/slic3r/GUI/3DScene.cpp +++ b/src/slic3r/GUI/3DScene.cpp @@ -585,6 +585,23 @@ int GLVolumeCollection::load_wipe_tower_preview( return int(this->volumes.size() - 1); } +GLVolume* GLVolumeCollection::new_toolpath_volume(const float *rgba, size_t reserve_vbo_floats) +{ + GLVolume *out = new_nontoolpath_volume(rgba, reserve_vbo_floats); + out->is_extrusion_path = true; + return out; +} + +GLVolume* GLVolumeCollection::new_nontoolpath_volume(const float *rgba, size_t reserve_vbo_floats) +{ + GLVolume *out = new GLVolume(rgba); + out->is_extrusion_path = false; + // Reserving number of vertices (3x position + 3x color) + out->indexed_vertex_array.reserve(reserve_vbo_floats / 6); + this->volumes.emplace_back(out); + return out; +} + GLVolumeWithIdAndZList volumes_to_render(const GLVolumePtrs& volumes, GLVolumeCollection::ERenderType type, const Transform3d& view_matrix, std::function<bool(const GLVolume&)> filter_func) { GLVolumeWithIdAndZList list; |