Exemple #1
0
    def draw(self):
        """Draws the planet and its orbit

        OpenGL-only function. Override the Ball draw function, as the orbit
        also has to be drawn.
        """
        # Draws orbit
        glColor3f(*steel_blue)
        glPolygonMode(GL_FRONT_AND_BACK, GL_LINE)
        glBegin(GL_POLYGON)

        time = 0
        while time <= self.period:
            pos, _ = self.getPos(time)
            coords = self.getGUICoords(pos)
            glVertex3f(*coords)
            time += self.period / 50

        glEnd()

        # Draws the planet
        Ball.draw(self)