CSE581; AU'11; Lab #2 - getting started

The suggested basic strategy is to get something working and then incrementally add stuff to it.

Here are some possible steps to turn Lab #1 into the basic display of the Lab #2 scene.
After each step, make sure the program still compiles and executes and does whatever new was put in.

  1. Add glut stuff to main()
  2. Display the Lab1 data using a transformation and a 'primitive' object:
  3. Display the square as the house body, in the correct position in world space with the specified world window.
    1. Replace the glScale() from the step above with (in the order of application to the square, i.e., bottom up):
      • translate by 0.5 in y
      • scale by 40 in x, 60 in y
      • translate by (40,5)
    2. Then put in gluOrtho2d() command to set the window coordinates to 0:150, 0:150 in x and y. Remember to change to the 'projection' matrix and first load the identity matrix before issuing the 'ortho' command. For now, you can put this in an initialization routine because nothing in the program will change it. Note that, after implementing the 'additional functionality', the world window might be changed so a new 'ortho' command will have to be issued whenever it changes.
  4. Use the matrix stack to isolate the 'global' translate of (40,5) and apply it to the house body, door and roof
    1. After the translate by (40,5), put in a push matrix command and after the call to draw the square put in a pop matrix command
    2. Now draw another square after the first square, bracketed by push-pop commands that will make the door
      • translate by 0.5 in y
      • scale in x and y by appropriate values
    3. Define a triangle primitive object and, similar to how you defined the door, put a roof on the house of height 30 and width same as the house.
  5. Add windows
    1. Each window should be an appropriately scaled square with 2 lines drawn on top of it.
    2. Each window should be translated relative to the house whose base is at (0,0)
    3. Each window should be bracketed by push-pop instructions.
  6. Draw an appropriately thick line to underline the house at (0,0). Use glLineWidth() to set the thickness of the line. Bracket this with a push-pop pair of matrix stack commands.
  7. Draw and place tree:
    1. Add a triangle as a primitive object
    2. put in a translate to (50,0) - translating tree, to be defined below this instruction, relative to house at (0,0)
    3. put in square and triangle code, each element bracketed by push-pops, that draw tree with base at (0,0) The tree will be constructed with base at (0,0), then translated relative to the house at (0,0) to (50,0), then translated along with the house to (40,5)