View Full Version : animation with image files

12-08-2006, 12:11 PM
Please Help,

I am trying to animate the state of a model (built with Triangular shapes) at various time steps. I would like to save the states of the model as a series of .ppm (or some other image file format)at each time step and then render the images in sequence (kind of like an animated "flip-book").

I am so new to OpenGL, I am unsure of even where to start. Is there a link or some simple code examples to illustrate this?

Thanks in advance for ANY help/hints.

12-09-2006, 03:38 AM
So you want to do, for each time step :

1) draw model with triangles.

2) get back image from openGL frame buffer to an array.

3) write the image data array to file, using an image library or doing it yourself.
The ppm and its family is pretty simple to do : http://netpbm.sourceforge.net/doc/ppm.html

Then, once images are written, you load them from the disk (either all at once or one by one, depends of the total size of course), and display them : to display using OpenGL you have 2 ways :
A) glDrawPixels(), see link for glReadPixels
B) use a texture mapped quad : needs a bit more opengl knowledge, but the fastest way, specially if you can store each image in a texture before hand, and just switch current texture.

free free to ask for more details on one or all these steps ;)