For assignment p3 you should read ch. 3 in the red book, in particular the section Manipulating the Matrix Stacks pp. 135-150. We will take a closer look at the code for building an articulated robot arm (pp. 146-150).
For assignment p3 you should read all ch. 7 (pp. 255- 279). You can leave out the last two pages, but don't miss the important section of Why Use Display Lists ? on page 256.
There are only two short paragraphs about the idle function in the red
book on pages 20 and 660.
We will see how to register an idle function and how to use it.
Create a directory lab4:
Download the following files to the lab3 directory:
compile robot.c torus.c torus1.c torus2.c
Change the permissions of compile to make it executable, type:
chmod 755 compile
To compile robot.c and create an executable robot type:
compile robot
Run the executable. We will see how the matrix stack was manipulated in this program.
Now compile torus.c and run it.
We will talk about display lists: why should we use them, and how to create and execute display lists.
Add an idle function in torus1.c. The place where you should add code are specified with the comment TODO. Compile the program and run it.
Now Change torus2.c so instead of calling the display list you call the torus function explicitly : this requires a single line change only. Compile the program and run it.
Can you see the differenece in performance between torus1 and torus2 ?