Project 3: Gyromesh

In this project, you will create a viewer for arbitrary triangular meshes written in the OBJ format. The user can rotate the mesh in any direction using the mouse. If the movement is forceful, the mesh will continue to spin on its own.


To receive credit for this project, you must meet the following requirements:

  • Create your project in a folder named gyromesh in the single Git repository that you are using for all your projects.
  • Using fetch, read in an OBJ file. Parse the file and convert it to a VertexAttributes instance with attributes for the vertices’ positions and normals. Add the faces as indices.
  • Light and shade the model with ambient, diffuse, and specular lighting. Use a positional light source.
  • Allow the user to rotate the model while the left mouse button is down. Use a trackball interface. If the movement on the last event is sufficiently large, keep the model rotating at a speed proportional to this distance.
  • Write your parser and renderer so that it works with any OBJ model. Position the light so that it sits outside the model’s bounding box. Set the transformations so that the model fits inside the window and is not clipped when its rotated.
  • Share in #gallery a link to a screencast in which you load a model and rotate it around. Host your screencast on a streaming service like YouTube or Vimeo.
  • Your code must be cleanly formatted, the variable names must be meaningful, and comments should explain non-obvious code.
  • Your Git log should reveal a steady pattern of commits. In general, you should commit and push after every work session.


If you finish early, consider exploring these extra challenges:

  • Animate the light source.
  • Read in material information from an associated MTL file.


When you have completed all requirements, push your code to your remote repository and send your instructor a direct message on Slack to schedule a 10-minute review. Only one project can be granted credit each week. Plan accordingly.


Leave a Reply

Your email address will not be published. Required fields are marked *