View Full Version : writing to image files??

11-15-2000, 02:23 AM
Im new at Opengl, so sorry if this is a stupid question. But I have created a basic viewing system and wish to output to avi or BMP or anything really. All of the help I have read so far just sends me to a page full of crap about the image file. Is there any source code that can be added into a project that writes your scene to a file?

Any help is appreciated.

Thank you

11-15-2000, 08:07 AM
Go to this URL: http://helios.scripps.edu/cgi-bin/infosr...OpenGL_PG/14979 (http://helios.scripps.edu/cgi-bin/infosrch.cgi?cmd=getdoc&coll=0650&db=bks&fname=/SGI_Developer/OpenGL_PG/14979)
you will find the information you need to copy data from the framebuffer to memory.
Once you have drawn your scene (and swapped the buffers if in double buffered mode), use glReadBuffer(GL_FRONT), this tells OGL that pixel reading operations are done on the front buffer. Then use glReadPixels to copy the pixel data (read the page at the URL I gave you).
Then you have to rebuild a BITMAP file from the data you've just read (windows bitmaps or targa bitmaps are very simple file formats).
Tell me if you need more information on these file formats.


11-15-2000, 11:27 AM
theres also an example here http://members.nbci.com/myBollux
(under the bgr extension)

11-21-2000, 07:10 AM
Also see "Function to Capture OpenGL Images to JPG (uses free IJL Library)" at http://codeguru.earthweb.com/opengl/snaptojpeg.shtml

I used this example and it works great...