sprite.py

"""Draw polygons in a sprite.
   by stephan)
"""
from slut import *

class Atlantis(World):
    def onSetup(self):
        self.name = "Sprite"

        Polygon(self, 'poly1')
        Polygon(self, 'poly2')
        self.sprites['poly2'].moveBy(-0.5, 0.0, -1.5)


class Polygon(Sprite):
    def onDraw(self):
        glBegin(GL_POLYGON)
        glVertex3f(0.0, 0.0, 0.0)
        glVertex3f(1.0, 0.0, 0.0)
        glVertex3f(1.0, 1.0, 0.0)
        glVertex3f(-0.5, 1.5, 0.0)
        glVertex3f(0.0, 0.0, 0.0)
        glEnd()


atlantis = Atlantis()
atlantis.run()
Initiated by Stephan Hechenberger
Thanks to CADRE's 103