Commit 46fcd0cd authored by sumpfralle's avatar sumpfralle

minor improvement of distributed processing

removed glGet during potential glNewList compilation


git-svn-id: https://pycam.svn.sourceforge.net/svnroot/pycam/trunk@1078 bbaffbd6-741e-11dd-a85d-61de82d9cad9
parent ae2f71cc
......@@ -115,7 +115,6 @@ class BaseModel(TransformableContainer):
# Rendering a display list takes less than 5% of the time for a
# complete rebuild.
list_index = GL.glGenLists(1)
print list_index
if list_index > 0:
self._opengl_display_cache[show_directions] = list_index
# somehow "GL_COMPILE_AND_EXECUTE" fails - we render it later
......@@ -195,7 +194,10 @@ class BaseModel(TransformableContainer):
self._opengl_display_cache = {}
def __del__(self):
self._reset_opengl_display_cache()
# Somehow remote pycam servers complain about this missing attribute
# during cleanup.
if hasattr(self, "_opengl_display_cache"):
self._reset_opengl_display_cache()
def _get_progress_callback(self, update_callback):
if update_callback:
......
......@@ -137,7 +137,6 @@ class Triangle(TransformableContainer):
GL.glPopMatrix()
if pycam.Utils.log.is_debug(): # draw triangle id on triangle face
GL.glPushMatrix()
cc = GL.glGetFloatv(GL.GL_CURRENT_COLOR)
c = self.center
GL.glTranslate(c.x, c.y, c.z)
p12 = self.p1.add(self.p2).mul(0.5)
......@@ -157,13 +156,10 @@ class Triangle(TransformableContainer):
for ch in id_string:
w += GLUT.glutStrokeWidth(GLUT.GLUT_STROKE_ROMAN, ord(ch))
GL.glTranslate(-w/2, 0, 0)
GL.glColor4f(1, 1, 1, 1)
for ch in id_string:
GLUT.glutStrokeCharacter(GLUT.GLUT_STROKE_ROMAN, ord(ch))
GL.glPopMatrix()
GL.glColor4f(cc[0], cc[1], cc[2], cc[3])
if False: # draw point id on triangle face
cc = GL.glGetFloatv(GL.GL_CURRENT_COLOR)
c = self.center
p12 = self.p1.add(self.p2).mul(0.5)
p3_12 = self.p3.sub(p12).normalized()
......@@ -182,11 +178,9 @@ class Triangle(TransformableContainer):
for ch in str(p.id):
w += GLUT.glutStrokeWidth(GLUT.GLUT_STROKE_ROMAN, ord(ch))
GL.glTranslate(-w/2, 0, 0)
GL.glColor4f(0.5, 1, 0.5, 1.0)
for ch in str(p.id):
GLUT.glutStrokeCharacter(GLUT.GLUT_STROKE_ROMAN, ord(ch))
GL.glPopMatrix()
GL.glColor4f(cc[0], cc[1], cc[2], cc[3])
def is_point_inside(self, p):
# http://www.blackpawn.com/texts/pointinpoly/default.html
......
......@@ -796,7 +796,9 @@ class PendingTasks(object):
self._lock.acquire(block=True, timeout=self._lock_timeout)
stale_start_time = time.time() - self._stale_timeout
stale_tasks = []
for (job_id, task_id), (start_time, info) in self._jobs.iteritems():
# use a copy to prevent "dictionary changed size in iteration" errors
current_jobs = self._jobs.iteritems()[:]
for (job_id, task_id), (start_time, info) in current_jobs:
if start_time < stale_start_time:
stale_tasks.append((job_id, task_id, info))
if stale_tasks:
......
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