PDA

View Full Version : beginner's question



goldov
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.

ugluk
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.

goldov
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.

ZbuffeR
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.

goldov
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.

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

ugluk
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:

http://nothings.org/stb_image.c

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.