|
|
|
Purpose |
|
| To use a different color model, and time-based animation. | |
|
|
|
Task |
|
| Write a C program using GLUT and OpenGL calls to create a "particle fountain". The program should create spinning triangles of different hues that enter the screen at the bottom center (the middle of the bottom edge), and arc up across the screen as if they are physical objects. The particles should be created at a steady rate (10 per second) and fade out over time (each should last 3 seconds).
There is no debug mode required for this assignment: use whatever debugging you feel is appropriate. |
|
|
|
|
Turn in |
|
| Your program should consist of a set of files which should be commented with your name and a description of the contents of that file, as well as the usual comments throughout the file. Your submission MUST include a makefile, and MUST be mailed to the class account as a single, uuencoded tar file (using the process described in the course newsgroup). Using MIME attachments to turn in files is NOT acceptable; the TAs may deduct up to 25% off your grade for incorrectly submitted assignments, so if you are unsure of how to submit, talk to the TAs BEFORE THE ASSIGNMENT IS DUE.
The time the mail is received will be used to determine whether or not the program is late, so be sure to allow a couple of minutes for the mail system to transmit your file if you are working right up to the deadline. IMPORTANT: If the TA has to edit your files, including your Makefile, you will lose up to another 25%. |
|
|
|
|
Due date |
|
| This program is due before class on Wednesday, November 3rd. This means it must be received by 9:59am EDT on Wednesday to not be considered late. | |
|
|
|
Additional Instructions |
|
| Particles
Each particle is a small spinning equilateral triangle (all sides the same length). It's color and motion are described by simple functions of time. Each triangle will have associated with it the following functions, the parameters of which can be determined when the particle is created:
When a particle needs to be drawn, its position, orientation and color can all be computed as functions of the time since it was created; thus, you will also need to store the creation time for each particle. The particles should be very small triangles. You should use an Ortho2D projection for your viewing transformation, and the size of the triangles should be roughly 1/25th of the size of the window (the exact size of the triangle will be a function of your Ortho2D parameters). Particle Fountain After the program starts, a new particle should be created every 1/10th of a second; you could use glutTimerFunc for this, or you could simply have the display routine remove the oldest particle and create a new one every 1/10th of a second. Since you are creating 10 particles per second, and each fades to black after 3 seconds, you will have 30 particles in motion at all times (well, at all times greater than 3 seconds after the program starts, as it will take 3 seconds to create the first 30 particles!) You should shine three lights on the fountain, one from directly above the fountain (mostly blue), one from the lower left front (mostly green), and one from the lower right front (mostly red). By mostly, I mean that you should have some red, green and blue in each light, but the majority of the light should be of one color. HINTS I suggest that you create a structure for the data needed for each particle, and create an array of 30 of these structures. You can then use this array as a circular or linear buffer, replacing the oldest particle with the newest one each time a particle is created. Time-based animation means that your display function should simply render the scene as appropriate for the current time when it is rendered. GLUT provides a platform independent way of getting the time, so your display function should simply render the fountain at the current time each time it is called. You should set up a timer function to use PostRedisplay() rerender your scene frequently (say, 20-30 timers per second). |
|
|
|
|
EXTRA CREDIT |
|
Extra credit will be given for doing the following, which will be worth an additional 10% if it is implemented correctly.
The extra credit program should be contained in a separate source file, and your makefile should create additional executable programs for it and the original. (ie. your submission must still contain an implementation of the basic program that perfoms as described above.) Rocketships. In this option, the particles (rocketships) must now be long thin triangles, as shown in the picture to the right. The short side should be 1/4 the length of the longer sides. The "major axis" of the triangle is perpendicular to the short side. The movement of the rocket is different than that of the original particles: the rocket should always be oriented so that the major axis is tangential to the path of motion at the current position (ie. the major axis should point in the direction of motion), and the rocket should only rotate about this central axis, not the 3 main axes. |
|