Commit 083ef7bf authored by Guillaume Seguin's avatar Guillaume Seguin

WIP #576: dereference numpy arrays after creating VBOs

parent 3c2bbdc1
...@@ -689,6 +689,12 @@ class GcodeModel(Model): ...@@ -689,6 +689,12 @@ class GcodeModel(Model):
self.vertex_buffer = numpy2vbo(self.vertices, use_vbos = self.use_vbos) self.vertex_buffer = numpy2vbo(self.vertices, use_vbos = self.use_vbos)
self.vertex_color_buffer = numpy2vbo(self.colors, use_vbos = self.use_vbos) self.vertex_color_buffer = numpy2vbo(self.colors, use_vbos = self.use_vbos)
self.vertex_normal_buffer = numpy2vbo(self.normals, use_vbos = self.use_vbos) self.vertex_normal_buffer = numpy2vbo(self.normals, use_vbos = self.use_vbos)
# Tentative memory optimization: delete numpy arrays after creating VBOs
self.travels = None
self.indices = None
self.vertices = None
self.colors = None
self.normals = None
self.buffers_created = True self.buffers_created = True
def display(self, mode_2d=False): def display(self, mode_2d=False):
...@@ -949,6 +955,9 @@ class GcodeModelLight(Model): ...@@ -949,6 +955,9 @@ class GcodeModelLight(Model):
self.vertex_color_buffer.delete() self.vertex_color_buffer.delete()
self.vertex_buffer = numpy2vbo(self.vertices, use_vbos = self.use_vbos) self.vertex_buffer = numpy2vbo(self.vertices, use_vbos = self.use_vbos)
self.vertex_color_buffer = numpy2vbo(self.colors, use_vbos = self.use_vbos) # each pair of vertices shares the color self.vertex_color_buffer = numpy2vbo(self.colors, use_vbos = self.use_vbos) # each pair of vertices shares the color
# Tentative memory optimization: delete numpy arrays after creating VBOs
self.vertices = None
self.colors = None
self.buffers_created = True self.buffers_created = True
def display(self, mode_2d=False): def display(self, mode_2d=False):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment