animation with image files

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.

So you want to do, for each time step :

  1. draw model with triangles.
    glBegin(GL_TRIANGLES)
    glVertex3f(…);

    glEnd();

  2. get back image from openGL frame buffer to an array.
    glReadPixels(…);
    http://www.opengl.org/resources/faq/technical/rasterization.htm#rast0015

  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 :wink: