CPSC 441: Computer Graphics |
Fall 2008 |
Assignment 2: Polygon Scan Conversion and Clipping [150 points]Due 9/21Purpose:This assignment is designed to help you become familiar with polygon scan conversion and clipping algorithms. The scan conversion section of this assignment will later be used in Assignment 4 as well. Description: In this assignment you will write a program that allows the user to input a set of polygons, scan converts those polygons onto the screen, allows the user to specify a clipping rectangle and displays the clipped polygons. You will NOT be using OpenGL's polygon or clipping commands. Instead, you will use the skeleton code provided. This code provides a 2D array for you to set color values and displays that 2D array. However, you may use OpenGL to draw anything else (lines, points, etc...) as part of the user interface for the assignment. You should write a program that:
Grading: [15] Capturing user polygon input correctly [55] Scan converting input polygons [5] Different color for each scanned polygon [5] Mode transition to clipping mode [15] Capturing clip rectangle correctly and drawing of clip rectangle [55] Clipping of polygons and scan conversion of clipped polygons FAQThe assignment says that we should use an active edge table to scan convert the polygons. Does that mean we can not use glBegin(GL_POLYGON)? As stated in the assignment page, “You will NOT be using OpenGL's polygon or clipping commands.” The entire point of this assignment is to test your knowledge of the polygon drawing and clipping algorithms… not to see if they’re implemented correctly in OpenGL. When the user drags the mouse during clipping, we need to draw the four edges of the clipping rectangle. Do we also need to change the background color inside the clipping rectangle to highlight it? You do not need to change the background color inside the clipped rectangle. You should only draw the outline of the rectangle. Should the polygons the users originally inputs always remain displayed in the screen? When the user is in clipping mode, only the portions of the polygons inside the clip rectangle should be visible. When the user is not in clipping mode, all of the polygons should be visible. Each time the user drags and lets go of the mouse, a clipping region is highlighted so nothing outside the clipping rectangle is displayed? Yes. While the user is dragging the clipping rectangle, you can show all of the polygons until they let go of the mouse button. Then you should clip the polygons and only draw what is inside the clipping rectangle. Alternatively, if you’re polygon drawing and clipping is fast enough, you can do it in real-time as the user drags the window. |
|||