Esempio n. 1
0
    def __init__(self):
        super(Application, self).__init__()
        self.lastFrameTime = time.time()
        self.runTime = 0
        self.angle = 0
        self.camera = Camera()
        self.mouse_move_valid = False
        self.mouse_last_x = None
        self.mouse_last_y = None

        #Culling type. GL_BACK is the default.
        #glCullFace(GL_BACK)
        #glCullFace(GL_FRONT_AND_BACK)
        glEnable(GL_CULL_FACE)
        glEnable(GL_DEPTH_TEST)
        # glDisable(GL_CULL_FACE)
        glMatrixMode(GL_MODELVIEW)

        resSpecs1 = Application.define_reservoir1()

        red = (0.8, 0.1, 0.0, 1.0)
        blue = (0.0, 0.0, 1.0, 1.0)

        self.triangle1 = glGenLists(1)
        glNewList(self.triangle1, GL_COMPILE)
        glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red)
        Draw.TriangleEquil()
        glEndList()

        self.cube1 = glGenLists(1)
        glNewList(self.cube1, GL_COMPILE)
        glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red)
        glColor3f(red[0], red[1], red[2])
        glPolygonMode(GL_FRONT, GL_FILL)
        Draw.DrawCube()
        glEndList()

        self.res1 = glGenLists(1)
        glNewList(self.res1, GL_COMPILE)
        glMaterialfv(GL_FRONT, GL_AMBIENT_AND_DIFFUSE, red)
        glPolygonMode(GL_FRONT, GL_FILL)  #(GL_FRONT_AND_BACK, GL_LINE)
        Draw.draw_res(resSpecs1)
        glEndList()

        self.lastFrameTime = time.time()