CS 45500 - Programming Assignment 3

This assignment is about using OpenGL transformations as described in the textbook in Sections 4.1 - 4.4 (though this assignment uses only 2D transformations). This assignment has three parts. Each part is an OpenGL program that uses a simple model and a number of transformations of that model to construct a complex scene. This assignment is due Wednesday, February 20.

Download this zip file. In the zip file you will find a skeleton OpenGL program called problem1.c and several image files that show sample results of the completed program. Your program should read an integer n off of the command line and then draw n equilateral triangles placed around the circumference of the unit circle. In the file problem1.c a model for an equilateral triangle is already defined. Your program should use OpenGL rotation, scaling, and translation transformations to place n instances of the model around the circumference of the circle. Here is what the result should look like when n = 8.

hw3-problem 1 with n=8

For the second problem, you will find in the zip file a skeleton OpenGL program called problem2.c that is supposed to draw the following hexagonal tiling. The file problem2.c defines a model that is a single hexagon inscribed in the unit circle. Your code should use OpenGL translation transformations to place the model in the world window so as to create the tiling (the world window has x between -10 and 10 and y between -10 and 10).

hw3-problem 2

For the third problem, there is a demo program problem3-demo.exe that lets you see what your program should do and an outline of the program in the file problem3.c. The program draws four scenes in four square viewports. Each scene is made up of 20 squares and in each scene the 20 squares are somehow distributed around a circle. The basic square used in every scene is a model that is included in the outline program. The scene in the first viewport just rotates this model around the origin. The slider is used to determine a maximum rotation of the model (the maximum rotation is sliderValue*360 degrees). The scene in the second viewport translates the model square to have one corner at the origin, and then it rotates this square (20 times) around this corner. The third viewport scales the square to have side length 1, and then it translates the square (20 times) so that its center is on the unit circle (in the demo program, the unit circle is drawn in green to help you see it; your final program doesn't need to show this green circle). The fourth viewport is similar to the third one, but the model is rotated clockwise by the amount sliderValue*360 degrees before it is translated (20 times) to a place on the unit circle. Each scene in each viewport should be drawn by using OpenGL translation and rotation transformations (along with appropriate OpenGL glPushMatrix() and glPopMatrix() operations) on the given model.

Turn in a zip file called CS455Hw3Surname.zip containing your versions of the three C programs problem1.c, problem2.c, and problem3.c.

This assignment is due Wednesday, February 20.


Return to the main homework page.
Return to the CS 45500 home page.


compliments and criticisms