Homework 1: Due September 5, 2003 (6/100 points)
Homework 1 Overview
The aim of this project is to get your feet wet in OpenGL, compile the software base, miniGL, which you'll use your projects and set up your development environment. You will learn how to install and set up your OpenGL system and perform a few simple, fun tasks. You will mostly be given some readings from the book and be expected to type in an accompanying sample program or cut and paste examples. You will also learn how to work with miniGL, derive classes for your use and how to modify the programs to perform tasks. Follow the instructions and type in code carefully. So, here goes:
- Get and install OpenGL and GLUT: First, get and install OpenGL and GLUT. Click here for instructions on how to get and install OpenGL and glut on your PC and get it ready to program in Visual C++. Note: that you can use any systems or high-level languages for your projects, but I will provide help and guidance mostly for Visual C++ on a windows PC.
- Get and compile the code base miniGL which is provided in zip format for the PC and tar format for unix. The README file may be useful in knowing how things are written and getting things going. You may also use a step by step guide on how to get miniGL going on the UNIX machines here . A Makefile has also been provided for the UNIX environment. The best place to start would be to copy the bounce or gear files and then replace the draw method with your own routines. Please make sure the class that you create is called hw01 and that the gears, bounce, evil, and stars are included (and will run) with what is submitted.
The goal of this homework is to create a new class derived from the cs4731app class. Most of your changes will be made in your draw function. Minimal changes may be necessary in the init, usage, reshape, key and special functions. This class must provide a series of methods (the implementation) for the miniglut class to call when events are generated. Four example classes (bounce, gears, evil and stars) are provided so you can see how to do the derivation and learn how to draw things onto the screen (using pseudo-pure OpenGL calls).
- Draw three dots: Read section 2.2 (page 42) of Hill book. Use the sample code in figure 2.10 (page 46) of Hill book to write a program for drawing three dots to the screen. Name the file appropriately and save it (E.g. HW1_ThreeDots.cpp). Remember to derive a class from the cs4731app class and not simply type in the code in a stand-alone project. Compile and run the program!!
- Sierpinski Gasket: Read example 2.2.2 (page 47) of Hill book. Use the following shell of the Sierpinski gasket to write a program which draws the Sierpinski gasket. The bodies of the GLIntPoint class, the random function, the drawDot function (figure 2.8, page 45) and the Sierpinski function (figure 2.14) have all been omitted. Type them in from example 2.2.2 and the appropriate figures in the text.Remember to derive a class from the cs4731app class and not simply type in the code in a stand-alone project. Compile and run the program!!!
To make your Sierpinski gasket prettier, in the for loop in the Sierpinski( ) function, change the number of iterations from 1000 to 50000. Drawing point size should be at 1
- Reading and drawing polyline files: Read section 2.3, especially example 2.3.2 on page 54 of Hill book to draw polyline files. Using the following shell write a program to read in a polyline file and draw it to the screen. The body of the drawPolyLineFile function has been omitted. Type it in from figure 2.22 on page 56. Remember to derive a class from the cs4731app class and not simply type in the code in a stand-alone project. Save and use the polyLine file dino.dat for your work. Compile and run the program!!
Note: Make sure you read the examples in the book before typing in the examples. Submit all executables and source files. Create documentation for your programs and submit them along with the projects. The documentation does not have to be unnecessarily long. Simply explain briefly what each example does and tie in your filenames.
Submission: Submit your Makefile and all your source files. Put everything in one directory on a CCC Unix machine, compile it and make sure it runs. Then tar everything up. The command to tar everything is:
tar -cvf FirstName_LastName_hw1.tar *