OpenGL animation

OpenGL ball The assignment was to use OpenGL to animate something.  The requirements were that the camera had to move, there must be a ground plane, objects had to be animated, and we had to implement object instancing.  I wrote the program using vi and the cc.

In this animation, I created a cube with 6 squares, each with a front face towards the center of the cube. A ball is placed in the center of the cube with a random color and random initial velocity. There is no velocity and the collisions are perfectly elastic. The light source is fixed, and the camera rotates around the cube. I used back face culling to give the cool effect of sides disappearing as the camera changes position.

My friend Joel had code for an mpeg player, so we used the example to figure out how to use make calls to the audio port on the SGIs.  I one note from a piece of music I had written and saved in MIDI format.  I converted the sound to raw audio and chopped it down so that it was short enough to be played at 1/30th of a second.  When the program runs, I buffer the sound, and spit it out when a collision is detected.  It turns out that the audio libraries are different between Irix 6.2 and 6.3, so the actual simulation with sound only runs on 6.3.  I have had the time to figure out how to get it to work on 6.2 yet.

After I got the program working, and turned into class, I wanted to show other people what I had done.  The trick was to get it into quicktime, so I could show the results.  To do this, I placed a screen capture call, right after the program sends the draw commands.  The screen capture dumped files in the RGB format.  From there, it's easy to compile a quicktime.

Of course, using the screen capture means I need another way to get the audio.  I kept track of the frames where collisions occurred.  Then using the SGI soundeditor, I was able to place the sound sample at the exact moment in time that a collision would occur.  I used the same audio sample that I had the program buffer earlier.  Combining the audio resulting audio file with the series of RGB images produced the quicktime that you can now see. ball.mov

















1