How to save a frame buffer and then put it back
all things in the framebuffer?
If you're trying to grab the current image in front / back buffers, glReadPixels (read a block of pixels from a framebuffer) along with glReadBuffer might be what you're looking for. see the OpenGL manual . This is not necessarily the fastest way to do it, depending on the extensions you can use with the hardware you have, there may be faster ways, but glReadPixels is pretty straight forward to use. glDrawPixels helps you return data to the framebuffer. You can just save the raw images to disk or convert / compress as you like.
a source to share
If you want to save all your objects to a file and load them back, I don't believe you should use OpenGL for that. When you submit objects to OpenGL, you often don't modify them again. If you are writing some kind of application to draw many objects on the screen, it would be easier to just keep track of the objects yourself.
If you want to get the final image, you can use glReadPixels - to get the raw pixel data, or glCopyTexImage2D - to save what's on the screen to a texture for later use in OpenGL.
a source to share