CS 420 Computer Graphics

Lab 5
Dr. Tong Yu, Fall 2009

Drawing Polygons

  • Login and open two windows, one for editing and one for compiling and executing programs.
  • Repeat the first part of lab 3 concerning usage of glViewport().
  • Make a new directory called polygon. Copy the program lines.c ( or lines.cpp ) to your polygon directory. Do the following:
    1. Modify the program by adding some filled polygons.
    2. Experiment with different colors.
    3. Try different polygon modes.
    4. Enable culling to see its effects.
  • ( Extra Credit 0.1 point )
      Suppose you use the Bresenham line algorithm to draw a line from ( 20, 30) to ( 250, 100 ). If the current point drawn is ( 33, 34 ), what will be the next two points drawn? Show your steps.
  • ( Extra Credit 0.1 point )
      Make use of glViewport() to display two sine curves on the same screen, one on the upper left region of the screen and one on the lower right.