Saving OpenGL screen as bitmap?

What would be a way to save the current OpenGL screen into a bitmap? I know it’ll involve glReadPixels() but how do you go about using it and using the data it collected to get a bitmap file? Thanks!

Check out the glReadPixels() man page and a description of the BMP file format .

Also, you might want to check out the Devil Image Loading and Writing library at -

 [Devil Image Handling Library](