Advertisement

Converting OpenGL to .png or .avi/mpeg?

Started by January 13, 2005 01:08 PM
5 comments, last by TerraX 19 years, 8 months ago
Dear fellows, Does anybody know how to save/load the openGL framebuffer to a .png file? Where can I find such code? I mean source code or some tutorial? Apart from that how to convert OpenGL animation to an avi or mpeg file. OpenGL to AVI not the opposite! Thanks in advance!
Well, first you have to capture the frambuffer with glReadPixels.
Then you have to save them in the proper file format.
I would suggest the tga format because it's pretty simplistic, allso because if you want to make an avi it's best to use tga sequences.

Just save every frame in sequence.
Remember to make the animation step dependent instead of time dependent.
Witch means that for every frame you forward the time with a preset timeinstead of the time that has passed since the last frame.
Advertisement
As lc_overlord suggests, your best bet would be to save your frames as Targas as it's such an easy format to use. You may want to have a look at this recent thread as it has some code examples to do exactly what you are asking.
--
Cheers,
Darren Clark
Or, you could try using something like DevIL. It has screenshot saving stuff built in.

http://openil.sourceforge.net/
Just to add: You'd want to support RLE compressed tga images, because it's quite easy and will reduce your filesize pretty much in most cases.
Killers don't end up in jailThey end up on a high-score!
Dear nife,
Any suggestions how to do that?
Any tutorials, links preferably in Linux GLUT?

Thank you!
Advertisement
Hi there, some time back, I wrote a class which can grab the backbuffer contents and export to an AVI (No sound though), here's the source for it, hope you find it usefull...
http://binarystudio.co.uk/externallyLinked/DGLAVI.zip

Happy coding,
Dave C.

This topic is closed to new replies.

Advertisement