Programming Assignment 1

Due Dates: Part 1 - Mon. March 24th; Part 2 - Mon. April 7th

Part 1 (30%)

The purpose of Part 1 is to a) provide experience in USING a graphics package and b) to provide one of the test programs for Part 2.

You are to write an application program which minimally uses the SRGP graphics package routines listed below. These routines are described in your text in Chapter 2 and in the SRGP reference manual.

State Routines:
SRGP_begin
SRGP_end

Primitive Operations:
SRGP_line
SRGP_polyLine
SRGP_rectangle
SRGP_fillRectangle
SRGP_polygon
SRGP_fillPolygon
SRGP_ellipseArc
SRGP_fillEllipseArc

Text:

SRGP_text

Attributes:
SRGP_setColor and/or SRGP_setFillBitmapPattern
SRGP_setLineStyle
SRGP_setLineWidth

Input Routines:
SRGP_setInputMode
SRGP_setKeyboardProcessingMode
SRGP_waitEvent

Output Format:

You might display an object on the screen, labeling various parts of the object, and displaying lines, polylines, polygons, rectangles, and ellipses, filled and unfilled, in different colors (patterns) and styles. Feel free to create more than one image. Your image(s) should stay visible on the screen until any key is pressed on the keyboard. Your image(s) should also be interesting!

NOTE 1: 20% of this the grade for this Part will be based (subjectively) on the how interesting/complex your design is.

NOTE 2: Examples of previous student work is available by running /usr/local/pub/ncs/graphics/lab1/demo.sgi or /usr/local/pub/ncs/graphics/lab1/demo.sparc. These are scripts containing two different sets of student work.

NOTE 3: I will select some of the better Part 1's to use for future demonstrations.

NOTE 4: Examples source programs provided with the package are available in /usr/local/lib/srgp/examples and in /usr/local/pub/ncs/graphics/lab1/lab1testdir.

NOTE 5: While the srgp graphics package is available on both the sparcs and the sgi's, you may find it easier to use the sparcs because of the availability of the debugger - dbxtool. This note applies to all subsequent programming assignments and parts as well.

Part 2 (70%)

The purpose of Part 2 is a) to provide experience in IMPLEMENTING portions of a graphics package and b) to provide an understanding of the line drawing and scan-line algorithms provided in the text.

You are minimally to implement the following SRGP routines using only SRGP_pointCoord as a basis:

SRGP_line
SRGP_polyLine
SRGP_setLineStyle
SRGP_rectangle
SRGP_fillRectangle
SRGP_polygon
SRGP_fillPolygon

Output Format:

Rename these routines with a 'my' prefix. For examples, 'SRGP_line' should now be 'mySRGP_line'. After making appropriate modifications to it, use your application program from Part 1 as one test case to show that your routines work properly. I will be linking my own test programs with your output routines to see if I can "break" them. These test programs are available in /usr/local/pub/ncs/graphics/lab1/lab1testdir.

NOTE 1: The makefile rule for making the target for Part 2 should look something like this:

$(CC) $(GCCFLAGS) $(INCLUDE) $(CFLAGS) -DUNIX -DX11 my_outputRoutines.c \ 
my_testProgram.c $(LDFLAGS) $(LDLIBS) -o lab1.yours

(See testMakefile in /usr/local/pub/ncs/graphics/lab1testdir.)

NOTE 2: Remember that SRGP uses ANSII C. A template for the output routines is available in /usr/local/pub/ncs/graphics/lab1/lab1testdir as well. See template_my_outputRoutines.c.

What to submit:

For Part 1, you are to submit a directory called lab1dir using the following command:

submit -v paw-grd lab1part1 lab1dir

where lab1dir contains your application program, a READ_ME file, and a makefile. (In the interest of disk space, no .o files or executables, please; you will lose points if these are submitted)

The makefile should include a target lab1, i.e., I should be able to type

make lab1.

This should compile your application program's source file(s) and create the executable lab1.lib, which is to be created by linking your application program with the SRGP library. (Use the Makefile in the /usr/local/lib/srgp/examples directory as a template.)

For Part 2, you are to submit a directory called lab1dir using the following command:

submit -v paw-grd lab1part2 lab1dir

where lab1dir contains the source for your application program, a file called my_outputRoutines.c or my_outputRoutines.mod, a READ_ME file, and a makefile. (Again no .o files or executables, please)

The makefile should include a target lab1, i.e., I should be able to type

make lab1.

This should compile the source files and create the executable file lab1.yours, which is to be created by linking your application program with your implementation routines.

Grading:

Your overall lab grade will be based on the following: the implementation of required routines, the demonstration of the required routines, the complexity (how interesting) of graphical output, internal documentation, and program design.

Hardcopy:

Hardcopy of all files including .h (if you have created any) and .c files, the makefile and your READ_ME file should be submitted by class time on the day following the due date for each Part.


March 18, 1997