Asg 3: Go 3D

Objectives

Implement a program to render a 3D object that rotates in place and translates.

Assignment

  1. Make sure the object rotates in place, i.e., rotates about its center. This means you will need to compute the object's centroid or average of all of its vertices.
  2. Additionally, implement object translation such that the object translates in any pattern you like around the screen (could be circular, could be bouncing off the window borders, could be moving with the mouse cursor, etc.). You will need to make sure that the order of tranformations is how they were presented, reading them from right-to-left.
  3. Go 3D:
    1. use perspective projection instead of orthographic
    2. render a 3D object read in from an .obj file

Suggestions

  1. You can (should) create an aw_t C++ class to store the geometry data read in from the .obj file. Minimally this class should contain:
      std::vector<glm::vec3 >       verts;
      std::vector<unsigned int >    vi;
      std::string                   group;
    	
  2. You could store the object's object center point in a vec3 oc variable.
  3. How to start?
    1. start by rendering a quad in 3D, i.e., set up the perspective and view matrices and test this first
    2. you will need to write a C++ parser for reading in the .obj file—I would also suggest writing a test driver that outputs the file contents to test that you can read and write (copy) the file
    3. rendering the object is fairly straightforward: load up the vertex buffer with vertices and then use an element buffer object to render using the indices stored in the unsigned int array (as done previously for the triangle for example)

Input

  1. Use our pyramid.obj file that we came up with in class as input.
  2. You will need to read in both vertex and fragment shaders from files, e.g., passthru.vert and passthru.frag.

Output

  1. The object should rotate and translate correctly.

Supplemental

  1. Provide a Makefile with a README if there any special program running instructions.

Turn in

Turn in all of your code, in one tar.gz archive of your asg##/ directory, including:
  1. A README file containing
    1. Course id--section no
    2. Name
    3. Brief solution description (e.g., program design, description of algorithm, etc., however appropriate).
    4. Lessons learned, identified interesting features of your program
    5. Any special usage instructions
  2. Makefile
  3. source code (.h headers and .cpp source)
  4. object code (do a make clean before tar)

How to hand in

See handin notes

Grading scheme