View Full Version : beginner's question

01-30-2011, 08:45 AM
Hello, i am a biginner, am just starting OpenGL. i saw examples of the 2-d and 3-d pictures using OpenGL. I would appreciate if someone let know whether it is possible to save such pictures, that are seen on the screen, into the graphical files (eps, png, jpeg etc.)? thanks.

01-30-2011, 09:02 AM
You can write your own snapshot code, or you can use an external snapshot program. What you choose to do is up to you.

02-01-2011, 12:39 AM
Hi, does anybody know how to write the snapshot code from within c++, that is what kind of libraries should one should use, or may be there are other ways of writing snapshot codes ? i would appreciate if you let know, may be, the references and the web-sites. thanks.

02-01-2011, 01:47 AM
Use glReadPixels to get the rendered data, then any image I/O library to write this as a file.
This one can do many formats : http://freeimage.sourceforge.net/
If you are fine with only one format, you can directly use libs such as libpng, libjpeg, etc.

02-01-2011, 06:56 AM
freeimage looks interesting and promising.
Does anybody know how to save rendered data in EPS format ? what kind of libraries one has to use ? or may be to write eps-file by your own ? thanks.

02-01-2011, 07:18 AM
GraphicsMagick (http://www.graphicsmagick.org/formats.html) can read/write any file format.

02-01-2011, 10:47 AM
This is easiest and the best, there's also a stb_image_write.h file on the same site:


I always use a screen capture program btw. If you are a noob and don't have much to show anyhow, why bother with the additional workload of writing snapshot code.