opengl project1

Course: Instructor:
Project 1: Date due:
“Introduction Computer Graphics,” ECS 175, Fall Quarter 2016 Bernd Hamann
“A SIMPLE TWO-DIMENSIONAL DRAWING SYSTEM”
Monday, October 10, 2016
For the first project you will implement the DDA and Bresenham line drawing al- gorithms, the algorithm for rasterizing polygons, the algorithm for two-dimensional clipping, and the two-dimensional transformations for scaling a polygon with respect to its centroid, translating a polygon by a translation vector and rotating a polygon about its centroid by an arbitrary angle. The program must be devel- oped using only a “MakePix” command available in the OpenGL graphics library. All higher-level graphics calls must be procedures written by you!
Besides displaying, filling, and transforming a set of predefined 2D polygons in a 2D window, user menues must be provided to interactively specify
• the ID of the polygon to be manipulated,
• the x- and y-extension of a viewport on the screen, and • the scaling factor, translation vector, and rotation angle.
The user should be able to change these parameters easily by providing a screen area used for displaying and manipulating these parameters. Make yourself familiar with the portion of that part of the OpenGL graphics calls you are allowed to use and need to use for this project. Define the 2D polygons to be displayed in a data file you read in. Each polygon is defined in terms of a set of 2D points (consecutive points implying an edge of the polygon) which could be stored in a data file in this fashion:
2
4
0.0 0.0 1.0 0.0 1.0 1.0 0.0 1.0
3
3.0 0.0 3.0 1.0 2.0 0.0
number of polygons
definition of 1st polygon: number of points of 1st polygon coordinates of 1st point coordinates of 2nd point coordinates of 3rd point coordinates of 4th point definition of 2nd polygon: number of points of 2nd polygon coordinates of 1st point coordinates of 2nd point coordinates of 3rd point
1
Only those parts of a polygon lying inside a user-specified viewport should be rendered. The scene should consist of at least three different polygons. Make sure that the user can specify which polygon is to be manipulated.
Finally, the scene (if it has been altered by some transformations) should be written to a data file replacing the one you read in.
Besides having to hand in a program listing, please prepare a “manual sheet” explain- ing how to use your program.
The overall grade (on a scale from 0 to 100) will depend on i) completeness (40%), ii) correctness (40%), iii) interface quality (15%), and iv) the manual sheet (5%). No project will be accepted when it is more than seven (7) days late; for each day, one (1) point will be deduced.
DO NOT REMOVE YOUR PROGRAM! YOU WILL BE ABLE TO USE IT IN THE NEXT ASSIGNMENT(S).
HAVE FUN !!!
2