CS 420 Computer Graphics


Lab 6
Dr. Tong Yu, Fall 2007

Canvas Class

  • Login and open two windows, one for editing and one for compiling and executing programs. Make the new directory ~your_login_name/cs420/canvas and copy all the files from /pool/u/class/cs420/canvas to it. Go to the directory to execute make to obtain the executable demo_canvas and the object files. Run demo_canvas to see how it works ( if necessary, modify the files so that they can be compiled properly ). Then flesh out each of the following member functions.
    1. setViewport();
    2. getViewport();
    3. clearScreen();
    4. setBackgroundColor();
    5. setColor();
    6. lineTo();
    7. moveTo();
    8. getWindowAspectRatio();

  • Make the directory ~your_login_name/cs420/curves copy all the files from /pool/u/class/cs420/curves to it. Compile and execute curves, which displays a parabola. Modify curves.cpp so that it displays other curves like hyperbola, ellipse, or spiral.
    Try the logarithmic spiral discussed in class ( see code in notes ) ( 0.1 EC )