Answers
Exercise A:
glEnable(GL_DEPTH_TEST)
objects = []
cube = Object(“Cube”)
cube.add_component(Transform((0, 0, -1)))
cube.add_component(Cube(GL_POLYGON, “images/wall.tif”))
cube2 = Object(“Cube2”)
cube2.add_component(Transform((0, 1, 0)))
cube2.add_component(Cube(GL_POLYGON, “images/brick.tif”))
objects.append(cube)
objects.append(cube2)
glEnable(GL_DEPTH_TEST)
..
..
while not done:
..
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT)
glRotatef(5, 1, 0, 1)
for o in objects:
o.update()
pygame.display.flip()