def draw(self, draw_geoms=None): """Draws the object; pushes correct GL matrix, calls draw() on every drive, restores GL. Optionally, specify the draw_geoms argument. Set it to False to not draw a hall, True to draw it, or None (that is, just leave it unset) to use the value from app.draw_geoms.""" if draw_geoms == None: draw_geoms = app.draw_geoms glPushMatrix() glTranslatef(self.pos[0], self.pos[1], 0) if self.ang > 0.00001: glRotatef(util.rev2deg(self.ang), 0, 0, 1) for d in self.drives: d.draw(self) if self.geom != None and draw_geoms: for x in self.geom.draw_drives: x.draw(self) glPopMatrix()
def draw(self, obj): """Puts the object on-screen somehow. This will be called by app in a state where GL is ready and GL units are meters.""" if self.drawing: need_pop = False if abs(self.rot_offset) > 0.00001: glPushMatrix() glRotate(util.rev2deg(self.rot_offset), 0, 0, 1) need_pop = True if self.offset != None: if not need_pop: glPushMatrix() need_pop = True glTranslatef(self.offset[0], self.offset[1], 0) self._draw(obj) if need_pop: glPopMatrix()