MAT 594CM PROJECT 1
The goal of my project was to expose myself to OpenGL/GLUT, implement simple camera navigation/zooming, and create a simple particle system. This project was my first introduction to 3D graphics programming of any kind.
Each "particle" in my program is generated by any number of overlapping OpenGL Quads. The program starts with a simple particle shape composed of 2 quads. Positions for each of the 4 points of the initial quad as well as the color are selected randomly simply using the rand() fucntion. Each additional quad added to the particle shape shares its first two points with the last two points of the previous quad. The user can add as many quads to the particle as desired by pressing 'r' on the keyboard. Pressing 't' will remove the last quad added. The original idea was to create some kind of randomly generating origami shapes and have them float around.
Figure1: Initial Shape
Figure 2: Initial shape after several quads have been added by the user
Alpha blending was enabled in OpenGL to get the transparent color effects. After the user crafts the initial particle shape the particle system can be activated by pressing 'o' on the keyboard. The program generates 5000 particles and uses simple accelerations and decelerations to control the movement. There is a minimum bounds on the y-axis to create a floor. Other than that restriction, the particles will fly off into infinity in the X and Z directions.
The component that makes the program generative is the fact that the OpenGL draw method is randomly adding or removing quads from the particle shape with each call. Every time a new quad is added is also has a random color, so the result is a system of particles flying at (or away from depending on camera angle) the user that are constantly changing in shape and color.
Figure 3: Still capture of particle system.
While the particle system is active the user can manually add or remove quads from the particle shape by pressing 'r' or 't' respectively. Changing the camera angle, zoom, and rotation of the particles can lead to some interesting textures.
Figure 4: Example output when returning to single particle mode (pressing 'm')
Figure 5: Example output when using Figure 4 in particle system, zooming, and moving the camera.
This project was extremely useful in helping me get a grasp on OpenGL and the introductory concepts of spacial computing. The program lacks in optimization and becomes sluggish for particles composed of many (roughly > 25) quads. The addition of shaders could greatly help appearance and give more of a 3D effect.
W - zoom in
S - zoom out
A - rotate camera left
D - rotate camera right
Q - rotate camera up
Z - rotate camera down
R - add quad
T - remove quad
I - rotate particle back
K - rotate particle forward
J - rotate particle left
L - rotate particle right
O - turn on particle system
M - turn off particle systme
P - pause the program (to take screen shots etc.)