Due: Wednesday 3/25 10:00am

Background:

Read up on moving to a polygon based framework in the online book. Focus on the introduction and Section 7.1. You should start working on this in code. If you think you’ve gotten a working polygon list framework, try turning your add_box code to a polygon based version (chapter 7.2.1). Then go from there

The Drawing:

  • Create new functions to add a polygon to a matrix, and go through the matrix 3 points at a time to draw triangles.
  • You should have a new triangle matrix that exists alongside the edge matrix. The edge matrix should be used for the shapes that are exclusively 2d (lines, circles, splines), and the triangle matrix for our 3d shapes.
  • Anything aside from shape drawing that modifies/uses the edge matrix (apply, clear, display, save) should now modify/use the triangle matrix as well.
  • Modify add_box, add_sphere and add_torus to add triangles to the new triangle matrix instead of points.
  • Make sure the parser calls the draw_polygons functions when needed.
  • Once all this is working, modify draw_polygons to correctly implement backface culling.