Write an interactive program, using OpenGL and its associated GLU and GLUT libraries, in which the viewer walks through a forest. Mouse drags should tilt the user's head vertically and horizontally, allowing the user to look around the world from the current position. The vertical tilt of the user's head should be constrained, so that it will not flip over. The w, a, s, and d keys allow the viewer to walk forward, left, back, and right, respectively, relative to the current view direction. That is, the user's feet always stay in alignment with the view direction as the user looks around. If you choose, you may implement motion using the arrow keys, in addition to w, a, s, d.
The motion should be smooth. You should calibrate the walking speed so that it is independent of the speed of the graphics hardware. The function glutGet (GLUT_ELAPSED_TIME)
will be important, which returns the number of milliseconds that have elapsed since glutInit
was called. By continuing to hold down the w, a, s, or d keys, the user should remain in motion.
This project should be an extension of the L-system tree code from Project 3, and the OpenGL viewer that was provided in that project. Note, here, that the meanings of the w, a, s, and d keys, and the mouse movements, are completely different than how they are implemented in the sample code. You will need to make some extensive modifications to the viewer.
The forest must be populated with at least ten of the L-system trees that you implemented in Project 3. You must pick your own method to size and position the trees. Using random numbers is encouraged. Select some rectangle within 2D space through which the user can walk, and if the user steps out of that rectangle, teleport the user to the opposite side to create the appearance of an infinite forest. You must place some type of polygon below the trees upon which the viewer walks. It might be colored green for grass, brown for soil, white for snow, or gray for rock.
Your project, like Project 3, should consist of two programs. The first, the modeler, rather than outputting the geometry in for a single tree, should output the entire forest (and, the ground polygon), in NFF format. The second program, the viewer, should be based upon the OpenGL viewer that was provided to you in Project 3.
glRotate
, glTranslate
, or gluLookAt
. You may still use gluPerspective to set the projection matrix. (5 points, mandatory for 634)
You should write your viewer based on the provided sample code from Project 3:
/afs/umbc.edu/users/r/h/rheingan/pub/435/Proj3
The Makefile
provided with the viewer allows it to be compiled on any Linux or Mac OS X system with freeglut
installed, including all of the campus Linux and Mac machines. It is also possible to build the viewer on Windows, but you will need to download and install the freeglut
library yourself, and set it up to work with your compiler. There is plenty of information online if you choose to work in Windows. Regardless, you must test your code on the UMBC Linux machines, as that is the environment where your program will be tested.