draw axes

This commit is contained in:
Josh Holtrop 2011-04-01 16:09:32 -04:00
parent edbfce91d2
commit bfe8d2a267

View File

@ -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()