Skip to content

Commit

Permalink
Fix for OpenGL related crashes
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelfranzl committed Jan 1, 2024
1 parent 1a61593 commit 75c119f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions classes/simulatorwidget.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,7 @@ def initializeGL(self):
opts)

def draw_stage(self, workarea_x, workarea_y):
self.makeCurrent()
self.item_create("CoordSystem", "csm", "simple3d", (0, 0, 0), 120, 5)

self.item_remove("working_area_grid")
Expand All @@ -127,6 +128,7 @@ def draw_stage(self, workarea_x, workarea_y):
self.dirty = True

def cleanup_stage(self):
self.makeCurrent()
item_keys = self.programs["simple3d"].items.keys()

keys_to_delete = []
Expand All @@ -141,6 +143,7 @@ def cleanup_stage(self):
self.dirty = True

def draw_coordinate_system(self, key, tpl_origin):
self.makeCurrent()
self.cs_offsets[key] = tpl_origin
cskey = "cs" + key

Expand Down Expand Up @@ -170,6 +173,7 @@ def draw_coordinate_system(self, key, tpl_origin):
self.dirty = True

def draw_gcode(self, gcode, cmpos, ccs, do_fractionize_arcs=True):
self.makeCurrent()
if "gcode" in self.programs["simple3d"].items:
self.item_remove("gcode")

Expand All @@ -186,6 +190,7 @@ def draw_gcode(self, gcode, cmpos, ccs, do_fractionize_arcs=True):
self.dirty = True

def put_buffer_marker_at_line(self, line_number):
self.makeCurrent()
if "gcode" in self.programs["simple3d"].items:
if 2 * line_number <= self.programs["simple3d"].items["gcode"].vertexcount:
bufferpos = self.programs["simple3d"].items["gcode"].vdata_pos_col["position"][2 * line_number]
Expand All @@ -197,9 +202,11 @@ def put_buffer_marker_at_line(self, line_number):
self.dirty = True

def get_buffer_marker_pos(self):
self.makeCurrent()
return self.programs["simple3d"].items["buffermarker"].origin

def draw_tool(self, cmpos):
self.makeCurrent()
if "tool" in self.programs["simple3d"].items:
# if tool was already created, simply move it to cmpos
self.programs["simple3d"].items["tool"].set_origin(cmpos)
Expand Down

0 comments on commit 75c119f

Please sign in to comment.