Homework 3: Due Friday, September 19, 2003, 9AM (11/100 points)
Homework 3 Overview
In this project, we're trying to familiarize ourselves with 3D modeling, first using miniGL, and next, we use the powerful SDL modeling language to help us recreate our models with relative ease. You will turn in two versions of a castle, one modeled using miniGL and the other modeled using SDL. The miniGL and SDL castles should look exactly the same. A few optional preparation steps are suggested. You will not turn in the code which you generate in your preparatory steps.
Extra Credit: The Virtual Reality Modeling Language (VRML) is a 3D modeling which allows 3D scenes to be loaded in a browser using a plug-in. X3D is an XML-based format which has been proposed by the Web3D consortium to replace VRML. Search and find a free X3D browser and online X3D tutorial and completely rebuild your castle in X3D.
- Preparation: A good place to start the homework is to read section 5.6 of Hill and type in examples 5.6.2, 5.6.3 and 5.6.4. This process will get you ready for the next sections. You will not submit this practice portion of the project but it would be a good start.
Important Note: The GLU Quadrics have not been set up in miniGL, so you can type in the openGL code (without using miniGL) to create these shapes. e.g. GluCylinder.
Note on getting SDL to work: Getting SDL to work is a simple three-stage process (listed below, and explained in Hill, section 5.6). Appendix 5 (pp. 897 - 903, 7 pages, of Hill) is an introduction to SDL. Combining SDL with miniGL affects the second and third stages but not the first. So, here are the steps (with miniGL).
- Get and include the files sdl.cpp and sdl.h in your program.
- Instantiate a scene class. Example: Scene scn; where scn is the name of your scene instance.
- Add the following three lines to your code:
scn.read("your scene file.dat"); // reads your scene scn.makeLightsOpenGL(); // builds lighting data structure scn.drawSceneOpenGL(); // draws scene using OpenGLIt may be worthwhile to create a small version of example 5.6.4 in Hill to test your SDL installation, even if you don't type in the entire model. Note: Simple.dat listed in the book is incomplete and may generate problems, so DO NOT USE IT!! So, type in the code in figure 5.67, and save it to a file called myScene1.dat. Your scn.read( ) call above should then read scn.read("myScene1.dat"). Section 5.6.4 specifically explains how to use SDL and appendix 5 describes how to write an SDL input .dat file.
Practice modeling using miniGL: Using the miniGL code base we've been working with, enhance the scene in example 5.6.3 by adding a solid models of a lamp on the floor and a chair.
- Behavior of your submitted program: Your submitted program should have the following behavior:
- User hits 'M' key (Part 1: Draw a castle using miniGL) Draw a 3D castle using miniGL. The castle is for entry into a national amateur architectural contest. An approximation would be fine - I wouldn't expect you to be able to create a state-of-the-art model - but it should be recognizable. You can choose a fixed configuration of components (location and orientation of doorways, windows, etc) though those of you planning on taking CS4732 might want to consider adding a reasonable amount of detail. Your castle must have at least 25 components. e.g. each sphere, glut mesh object, cube, etc counts as one component.
You should keep the level of detail and complexity in your object low until you get the basic functionality down, and then use your imagination to make it as interesting as you wish. For example, a basic castle could be approximated with a number of cylinders, spheres and boxes, and later enhanced by varying sizes, shapes, and detail. Don't get too detailed, though, as the computational demands in executing your program may become quite tedious during debugging and refinement!
Finally, remember that your model will be reused in some of the following projects. Hence, you should invest some effort into building a model that you can improve and build on later. You don't have to add color or 3D effects like shading or texturing yet since We haven't covered them in class, although people who decide to add any effects won't have points taken off.
- User hits 'S' (Part 2: Draw a castle using SDL) Redraw your castle, this time using SDL.
Note: The preparatory exercises above should not be submitted. Only the castles using miniGL and SDL) should be submitted. 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 file does,how to run it and tie things in nicely.