Example insect model

Programming Assignment 2

Due Tuesday October 13 by 11:59pm

This assignment will introduce you to 3D modeling and transformations in OpenGL. You will develop a program that allows the user to control a simulated insect, scorpion, or spider.

The emphasis in this assignment is on using hierarchical transformations in OpenGL to define legs and other moving parts of your creature. You will design your own creature using 3D primitives.

This assignment is challenging. Start programming early.

Get Some Files

We do not provide a template for this assignment. Instead, you are given an example of a working program from a past year's assignment P2: modeling a human hand. You can adapt this working example program if you'd like.

Note: You are to model an insect, scorpion, or spider in this year's assignment. Your model should have a structure that is similar to the anatomy of an insect, scorpion, or spider. In other words, your model's parts, legs, and joints should be based upon a real insect, scorpion, or spider.

Java files

PA2.tar source files for a working PA2 from 2011. The description of that assignment and its keyboard interface are available here: 2011 PA2.

Example Scorpion Animation Tool

An example of a fully functioning scorpion animation tool is available here. Note that you will design your own 3D model for an insect, spider, or scorpion. Search the Web for photos.

Note that you are expected to define your own keyboard interface that is best for controlling the joint angles of your creature. Your interface may be different from the example programs provided here. The user interface for the example program is provided through mouse buttons and keyboard:

The Code You Write

You are expected to write a program that will simulate a 3D insect, spider, or scorpion.
  1. Use OpenGL to construct a 3D insect, spider, or scorpion model from cylinders and/or ellipsoids.   The model need not be anatomically accurate, but each limb should have at least three joints.  You can model the body as a single ellipsoid.
  2. Write code that enables the user to change the angles at each joint in the creature's body model via the keyboard interface that you define.
  3. Limit the angles at each joint within reasonable ranges so that creature's legs, neck, head, and any other parts don't bend in unnatural ways!

Required for CS680 Students

Add eyes to the creature model. Make the eyes automatically follow the mouse position.

Extra Credit

Apply a texture map to your model that makes surface appear more realistic.

Test Cases

As mentioned above, you are to add a keyboard input 'P' that cycles through 5 (five) different poses of the creature that you defined.


Part of your grade for this programming assignment will be based on your giving a short demo (5 minutes) in the CS instruction laboratory. 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, as well as some additional, surprise testing of the joint angles. Demos will be scheduled during the lab section meetings, after the due date.

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)


3D creature model constructed of ellipsoids, cylinders, boxes, and/or spheres 25 points
Proper rotation at the joints 25 points
Limit rotation so that limbs do not bend in unnatural ways 10 points
Your predefined creature poses work properly 30 points
Programming style  10 points
Texture mapping 10 extra credit 


3D creature model constructed of ellipsoids, cylinders, boxes, and/or spheres 20 points
Proper rotation at the joints 20 points
Limit rotation so that legs do not bend in unnatural ways 10 points
Your predefined creature poses work properly 30 points
Eyes, where eyes follow the mouse cursor in the window 20 points 
Texture mapping 10 extra credit

Late Assignment Policy

Late programming projects and problem sets will be levied a late penalty of 12% per day (up to three days). In other words, lateness will be penalized at 0.5% per hour late. After three days (72 hours) no credit will be given.

Collaboration/Academic Honesty

The code you submit must be your own. If you find/use information about specific algorithms from the Web, etc., be sure to cite the source(s) clearly in your sourcecode.

Please be aware that the code submitted for this course is automatically analyzed using a code plagiarism detection program. Code flagged as suspicious by the program will be examined by the teaching staff and action will be taken in cases of plagiarism. BU Academic Conduct Code.

All instances of academic dishonesty will be reported to the Academic Conduct Committee.