Movies from OpenGL

This is how to make a movie from your OpenGL programs, which you can put on a web site or otherwise distribute to impress your family, friends, and potential employers.

Download the C version or Java version of MovieCube. Inside the tar file is a modified cube program and glmovie.h/.c or GLMovie.java that captures the OpenGL frame buffer as an image file.

The cube source has a few new lines, marked by "NEW" comments. There are various capture parameters you can set, but the defaults work.

(Note on the capture code: the Java multithreading works but probably isn't very good, as I have very little experience with Java concurrency. If you can do better, please fix it.)

Build and run the MovieCube program. You start capturing frames by pressing the M key or choosing Movie from the menu, and press/choose again to stop. This will generate a numbered sequence of PPM files in the /tmp directory. Stop after twenty or so.

You can preview the movie with

$ animate /tmp/username*.ppm

animate is part of ImageMagick. The frames will be upside down: this is nothing to worry about and will be fixed in the final movie.

Assemble the frames into the final output file with

$ convert -flip /tmp/username*.ppm cube.mpg

This will take several minutes to complete. convert is another of the ImageMagick tools.

You now have an MPEG file. You can view it with

$ ffplay cube.mpg
on the R105 PCs, or with any other movie player application that understands the format, such as QuickTime Movie Player on a Macintosh.

Now that you know how it's done, add the capture code to Assignment 2. Things to look out for:

Please email Hugh Fisher if you have created a movie from your assignment and would like it to be included in a COMP4610/6461 online gallery.