CS 551: Introduction to Computer Graphics
Assignment #3
Goal: Implement Sutherland-Hodgeman clipping for arbitrary planes.
Assigned: Thursday, February 23, 2000
Due: Tuesday, March 7, 2000
Relevant reading/files/software:
Synopsis: Your program will load a polygonal object and use OpenGL to render it. You will write code to clip the model to two arbitrary clipping planes before rendering using the Sutherland-Hodgman algorithm. You will need to design a form in fdesign that contains:
As usual, the single best assignment (measured by ease of use and "extra" features) will earn an 11 (one point extra credit).
Turning in the assignment: Before class starts on Thursday, March 7, you should:
Specifics: We are providing the usual Makefile, a C file named gfx.c, which contains code to draw into an Xforms glCanvas, and a header file gfx.h, which contains prototypes for the functions in gfx.c. The gfx.c file will set up lighting so that front-facing polygons will be drawn one color and back-facing polygons another. As usual, you will modify the functions in gfx.c, adding code to draw the scene and handle callbacks. You will also create a form in fdesign. Saving that form (as a .fd file) will also create .c and .h files that contain the Xforms library code for creating the form, which you must include in your program via the Makefile. Some special things to notice about the code:
create_form_* call; the Xforms documentation has details. To make the code in gfx.c work correctly you must name this variable myForm. Your form must include a glCanvas object, which you must name myCanvas. canvas_expose() which will redraw the canvas when it is created or covered and exposed by another window. After the create_form_* call, you must attach this function to your canvas with the line:fl_add_canvas_handler(myForm->myCanvas,Expose,canvas_expose,0); Advice: OpenGL has direct support for clipping to arbitrary planes. Don't even think about it. :-)