Save rendering as animation

Hi I saw some web pages were examples were shown with animated .gif images, and it was looking very good. So I wonder how to save the frame buffer into an animated gif file, or any image formt (even not animated), and if there is a way to render into a file rather than to the frame buffer.

Thank u.

you can catch the framebuffer with glReadPixels()

when you have the pixels, you save them to a common file, say jpg.

then use some application to pack them into a gif: paintshop pro comes with a program to let you do stuff like this.