CIS 425 Assignment 3
Due Wednesday, March 31, at midnight
A Bug Visits a Garden
For this program you will build a simple bug – all it needs is a body, 2 wings that can flap, and a proboscis. The body can be just a sphere, the wings flattened spheres and the proboscis an elongated cube, or you can design it some other way. Extra: Add stripes, spots, tatoos(?),… Teach your bug to flap its wings. This will be done with the idle function. Use W key to toggle wing flapping.
You will need a home for your bug – a nest, a hive, a bump on the ground – you choose. You also need three flowers, not in a row, spread out on the ground. (The home and the 3 flowers should make some kind of quadrilateral.) The flowers can be made of a variety of 3D glut shapes. They can be the same but different colors, or (extra) they can be substantially different from each other. Feel free to add other items to your scene.
In advance you have made a flight plan. (extra) You could make this path visible/invisible (or faintly visible with a stippled curve), by pressing the P key. When the F key is pressed, your bug leaves its home, flies off, visiting all three flowers. As an extra, the bug will not jump from flower to flower, but will fly smoothly, going through points in between, making the flight look smoother. Another nice extra, the bug turns smoothly and always faces the direction it is moving. Another extra, the bug pauses (not long!) to drink from each flower. As it flies, for extra, you could show the bugs shadow. Other shadows? The flight uses a timer function. You can design it so it is not possible to stop the wings while in flight, or, as an extra, what interesting happens if the bug stops flapping its wings?
It would be nice to be able to view all of this from different sides. Pressing 1, 2, 3, or 4 lets us view the scene from the North, the East, the South and the West respectively. All these views are in perspective, using glFrustum or gluPerspective. In all these views we should be able to see the bug, its home, and the three flowers.
Pressing 0, we get a view from overhead, high enough to see the bug, its home, and the flowers. This should be an orthographic view. In this view, if the mouse clicks on one of the three flowers, it can be dragged to a new location. For extra, the flight path changes to accommodate this change.
You do not need 2 windows, but you could (extra) have 2, displaying the scene from the side and from overhead simultaneously.
Pressing the R key, for reset, returns everything to the original setup.
Since sometimes it is nice to view what is going on slowly, and sometimes we want to see it quicker, please include a global constant SPEED that the user can set before running to speed up or slow down the action. Also, include the ability to increase, decrease speed using the up and down arrow keys.
Explore the glut solids, the more different ones you use, the merrier (now where should I put that teapot?) Remember they can be stretched in various ways, so a sphere can become a wing, a cube can become a proboscis.
This is a 3D assignment. Make good use of the depth buffer.
Since I have to test lots of programs, please stick with the keyboard and mouse commands as specified. Feel free to add more, of your choice, in addition.
F fly the path
W make the wings flap, or stop flapping.
left click and dragging to move flowers. (in 0 view)
1,2,3,4, 0 – change view
P- toggle view of flight path
R reset view
Up and down arrow, adjust speed of flight.
(I have used green for extra and blue for buttons/mouse. If you cannot see these colors, let me know and I will make a version using different fonts.)