Programming Assignment 1

Submitted code is due Tuesday, September 22 before midnight

Program Demos during labs on Wednesday, September 23

This programming assignment is meant to acquaint you with scan conversion algorithms. You write two functions, which you compile and link with a main program that is provided. The resulting program will draw lines and triangles.

Get Some Files

A Java program skeleton and some basic functions and the sketch tool's main program are provided for you. So, before you begin programming, you will need to download source files.


You are expected to complete the sketch program by providing two missing functions using the code templates. There are comments in the skeleton code that will help guide you in writing your own subroutines. 

Installing the appropriate JOGL, JDK and programming environment will be covered in the lab session On Wednesday, September 9.

Run the Example Sketch Tool

Working example of the Sketch Tool:

Run the example working sketch tool to see how your program should work. Please note that the final test case (texture mapped triangle fill) is not demonstrated in this working example; therefore, this final test case displays as a blank window. If you implement texture mapping, then this final test case will be displayed in your working program.

The user interface to the program is provided through mouse buttons and keyboard keys:

The Code You Write

You are expected to write two new functions based on the templates provided

  1. Write a line rendering function that uses Bresenham’s algorithm to draw lines, with support for smooth color interpolation, given vertex colors.
  2. Write a triangle rendering function.  Your function should provide smooth bilinear interpolation of the vertex colors in smooth area fill mode. For flat shading of the triangle, use the first vertex color. Note: You cannot use the polygon scan fill algorithm given in the textbook.

Required for CS680 Students (extra credit for CS480 students):

Implement texture mapped area fill of triangles using bilinear interpolation.  You should add a key interface callback M that toggles texture mapped area fill on/off.

Extra Credit:

Implement anti-aliased rending of lines and triangles.  Add a key interface callback A that toggles anti-aliasing on/off.

Test Cases

A number of test cases are provided. To toggle between the test cases, press the T key.  You can preview these test cases in the working example sketch tool, and compare the results with those of your own implementation.


Part of your grade for this programming assignment will be based on your giving a short demo (5 minutes) during the CS480/680 schedule labs on Thursday afternoon following the assignment due date. You will be expected to talk about how your program works, and we will see how well your program performs on the aforementioned test cases, and perhaps some additional, surprise test examples. 

Source Code Submission

Your program's source files are to be submitted electronically. Use the gsubmit program on the CS cluster.

The code you submit should conform to the program assignment guidelines.

Grading (Out of 100 points)


Line drawing, with vertex color interpolation

40 points

Drawing of triangles, all orientations, including smooth fill and flat fill

50 points

Programming style

10 points

Antialiasing of lines and triangles

10 points extra

Texture-mapped fill of triangles

15 points extra


Line drawing, with vertex color interpolation

30 points

Drawing of triangles, all orientations, including smooth fill and flat fill

35 points

Texture-mapped fill of triangles

25 points

Programming style

10 points

Antialiasing of lines and triangles

10 points extra


Late Assignment Policy

Late programming projects and problem sets will be levied a late penalty of 0.5% per hour (up to 72 hours). After 72 hours (3 days), no credit will be given.

Collaboration/Academic Honesty

All course participants must adhere to the Academic Conduct Code. All instances of academic dishonesty will be reported to the academic conduct committee.



Created:  September 2, 2015