CS 551/645: Introduction to Computer Graphics
Assignment #1
Goal: Hello World program to get you started. You will learn how to use Xforms, Makefiles, and Unix in general.
Assigned: Wednesday, September 8, 1999
Due: Monday, September 13, 1999
Relevant reading/files/software:
Synopsis: A simple "Hello World" sort of program. We will provide source code for a function that, given an OpenGL context, draws a simple scene (either a cube or icosohedron, depending on which function it calls). You will need to design a form in fdesign that contains:
Doing all of this will earn you an 8/10. To earn extra points, you will want to implement some "bells and whistles". There are many possible extras that could be added, such as:
These are just two very simple examples; you should be able to think of many more on your own. As usual, the single best assignment will earn a 10.
Turning in the assignment: Before class starts on Monday, September 13, you should:
Specifics: We are providing a Makefile, which contains rules for compiling and submitting programs, and a C file named gfx.c, which contains code to draw into an Xforms glCanvas. You will 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 doucmentation 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.rot represents the amount of rotation applied to the object drawn by draw_icos() or draw_cube(). The variables BGr, BGg, and BGb store the red, green, and blue components of the background color. By altering these variables, you can affect the behavior of the graphics subroutines without worrying about the code therein.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);