570/761 Programming Assignment 2

Due: Friday, October 8, 2004


The purpose of this programming assignment is to provide


You are to write an application program which MINIMALLY uses the OpenGL API to try the following (MINIMALLY = all of the following):

EffectOpenGL commands needed
OpenGl Setup glutInit, glutInitDisplayMode, glutInitWindowSize, glutInitWindowPosition, glutCreateWindow, glutMainLoop, glutDisplayFunc, glClearColor, glFlush or glSwapBuffers
Using different primitives (lines, line-strip, line-loop, triangles, triangle-strip, triangle-fan, rectangle, quads, quad-strip, polygon) glBegin/glEnd, glVertex, glRect
Using different attributes (line style, line width, fill style, color) glLineStiple, glLineWidth, glPolygonStiple, glColor, glEnable
Using different window-to-viewport transformations, and the resulting clipping, scaling, potential change in aspect ratio glViewport, glMatrixMode(GL_PROJECTION), glLoadIdentity, glOrtho or gluOrtho2D
Moving from one screen to the nextglutMouseFunc, glutPostRedisplay

Output Format:

What you "draw" is up to you, but I would anticipate several different screens that I can move between by pressing a mouse button, i.e., your image(s) should stay visible on the screen until either mouse button is pressed and released. Your image(s) should also be interesting!


  1. You are expected to use EACH of the routines mentioned above.
  2. You are expected to use the window-to-viewport transformations to constuct an original image composed of a variety of pieces, i.e., such as that shown in class using DrawWorld();
  3. Example source files are available in my public directory /usr/local/pub/ncs/graphics/OpenGL/ExamplesLab2/.
  4. "Best Of" selections from previous quarters are available for your viewing from the course page http://www.cs.rit.edu/~ncs/Courses/570.shtml. You'll need to copy the executable into your Unix account to run them. I will select the "best" of your submittals to add to the web page and for use in future demonstrations.

What to submit

You are to submit a directory called lab2dir using the following command:

submit -v ncs-grd cg1lab2 lab2dir

where lab2dir contains your application program lab2.c, a Readme file, if pertinent, and a makefile. I should be able to type

make PROG=lab2

to compile your application program's source file(s) and create a UNIX executable lab2, which is to be created by linking your application program with the OpenGL and GLUT libraries.

If you choose to use C++, instead of C, please be sure to include a Makefile which has been modified to meet the specifications above.


  1. You are expected expected to use the names Readme, lab2dir, and lab2 as specified above. As I am using scripts to help with the grading process, failure to do so is annoying and you will be suitably awarded! :-)
  2. You are expected to include a Makefile and it should function as specified above.
  3. Your directory should only include the source files, any header files that you have created, a Readme file and a Makefile, i.e., please remove any backup files, executables, etc. before submitting.


Your overall programming assignment grade will be based on the following: demonstration of the use of the required routines, the complexity (how interesting) of graphical output, internal documentation, and program design. The gradesheet I will use can be viewed here.

When I begin grading your submittal, if there are any problems, I will send you e-mail and you must then resubmit within 24 hours. Incorrect submittals are subject to penalties!

Nan C. Schaller
Rochester Institute of Technology
Computer Science Department
102 Lomb Memorial Dr.
Rochester, NY 14623-5608
telephone: +1.585.475.2139
fax: +1.585.475.7100
e-mail: ncs@cs.rit.edu
August 25, 2004