示例#1
0
文件: square.py 项目: mihaiv95/cube
 def draw(self):
     glMatrixMode(GL_MODELVIEW)
     glPushMatrix()
     glMultMatrixf(self._identity_mat)
     glColor3f(self._color[0],self._color[1],self._color[2])
     for edge in self._edges:
         Edge.draw_edge(Edge(self._vertices[edge[0]],self._vertices[edge[1]]))
     glPopMatrix()
示例#2
0
    def draw(self):

        glMatrixMode(GL_MODELVIEW)
        glPushMatrix()
        gluLookAt(-2, 2, -6, 0, 0, 0, 0, 1, 0)
        glMultMatrixf(self._identity_mat)
        color = 0
        colors = [(1, 0, 0), (1, 1, 0), (0, 1, 1), (1, 0, 0), (1, 1, 0),
                  (0, 1, 1)]

        for edge in self._edges:
            glColor3f(colors[color][0], colors[color][1], colors[color][2])
            if color > 2:
                Edge.draw_dotted_edge(
                    Edge(self._vertices[edge[0]], self._vertices[edge[1]]))
            else:
                Edge.draw_edge(
                    Edge(self._vertices[edge[0]], self._vertices[edge[1]]))
            color += 1

        glPopMatrix()