saving to a file

How do I save a generated graphic as jpeg/gif or any form so it can be displayed on the web?

Thanks in advance
PS: I am VERY new to opengl.

if your using windows… just hit the
alt-printscreen key and then paste do
a paste in mspaint…

I need to do this with the actual C++ code.

The program runs on xx min intervals to generate various graphs, which must then be displayed (refreshed) on the web.

Isn’t there any way to generate the graph, and save or export that as an image file automatically?

Thanks.

Once you have generated the image you want use glReadPixels to get the image data into an array.

I can’t remember exactly but some of the function parameters are the start x / y and the height and width you want to scan (i think - use the Red book to help you).

Anyway to save this to a file is easy. unfortunately you need to save it to a file format you can use. i’d recommend getting the .bmp file format or the .tga format specifications (www.wotsit.org)(other people can help you on this one as i dont know which one’s best / easiest)

Anyway convert the array to the format you need, save the file headers and such like and you’ll be set. (as a word of warning this is quite in-depth for a beginner IMHO so there may be another way around this i haven’t considered ?

Good luck
Allan