diff --git a/SketchWidget.py b/SketchWidget.py index e2414c5..b068ced 100644 --- a/SketchWidget.py +++ b/SketchWidget.py @@ -77,6 +77,8 @@ class SketchWidget: glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) + self.drawAxes() + for shape in self.sketch: if isinstance(shape, Line): self.drawLine(shape, 1.5) @@ -159,3 +161,11 @@ class SketchWidget: angle = i * 2 * math.pi / steps glVertex(x + radius * math.cos(angle), y + radius * math.sin(angle)) glEnd() + + def drawAxes(self): + glPushAttrib(GL_CURRENT_BIT) + glColor(1.0, 0.4, 0.4, 1.0) + cx, cy = self.ptToScreenPt((0, 0)) + self.drawFilledLine(cx - 25, cy, cx + 25, cy, 1.5) + self.drawFilledLine(cx, cy - 25, cx, cy + 25, 1.5) + glPopAttrib()