Horde3D
http://www.horde3d.org/forums/

Screenshot function
http://www.horde3d.org/forums/viewtopic.php?f=1&t=1151
Page 1 of 1

Author:  karstux [ 19.04.2010, 11:38 ]
Post subject:  Screenshot function

Dear all,

I needed to write out frame-by-frame images from an animation as rendered by Horde, so I've added a simple screenshot functionality to the engine. I realize that this would be trivial to implement in any application, but I found it convenient to realize it as a "h3dutScreenshot()" function.

Would there be any interest in the code? If so, I could of course post it. Unfortunately, it does introduce a new dependency - I use libjpeg-turbo to compress the framebuffer image before writing to file.

Karsten

Author:  Volker [ 19.04.2010, 13:12 ]
Post subject:  Re: Screenshot function

I guess rewriting your screenshot function to use TGA (so no need for a dependency) would be trivial, so posting it may be helpful for others in all cases, even it is currently used with jpeg.

Author:  karstux [ 19.04.2010, 14:14 ]
Post subject:  Re: Screenshot function

Ok, here is the code. I'm not really familiar with diff and patch, so I hope I didn't make any mistakes... all changes are relative to Beta4. The changes to Horde3d.h and egRendererBase class were made to be able to retrieve the size of the OpenGL window. Horde3DUtils.h and main.cpp contain the actual screenshot code. The changes will compile and link with either the IJG reference libjpeg or with libjpeg-turbo, a much faster alternative.

Using TGA would be trivial indeed, but it wasn't an option for me - I had to be able to write compressed images really fast. Saving a JPG screenshot takes 10-12 ms on my machine, so I can use it to capture longer sequences of real-time interactive stuff.

Attachments:
patches.zip [3.54 KiB]
Downloaded 860 times

Author:  marciano [ 20.04.2010, 00:16 ]
Post subject:  Re: Screenshot function

karstux wrote:
The changes to Horde3d.h and egRendererBase class were made to be able to retrieve the size of the OpenGL window.

Just as a note, a similar function (h3dGetViewportParams) is available in the trunk.

karstux wrote:
Using TGA would be trivial indeed, but it wasn't an option for me - I had to be able to write compressed images really fast.

Yeah, TGA is too slow for capturing a video, as the disk writes for the raw data are much more expensive than running a compression algorithm.
It would be nice if someone would write an extremely lightweight one-file JPEG compressor one day (with the same philosophy as stbi that we use for image loading) ;)

Author:  zoombapup [ 15.07.2010, 13:00 ]
Post subject:  Re: Screenshot function

I used librevel to literally write out a video from the engine. Works pretty well.

Author:  swiftcoder [ 16.07.2010, 02:00 ]
Post subject:  Re: Screenshot function

marciano wrote:
Yeah, TGA is too slow for capturing a video, as the disk writes for the raw data are much more expensive than running a compression algorithm.

It would be nice if someone would write an extremely lightweight one-file JPEG compressor one day (with the same philosophy as stbi that we use for image loading) ;)
A much cooler option (though considerably more complex to implement), is real-time video compression on the GPU, a la Cameni's technique.

Author:  marciano [ 19.07.2010, 21:20 ]
Post subject:  Re: Screenshot function

swiftcoder wrote:
A much cooler option (though considerably more complex to implement), is real-time video compression on the GPU, a la Cameni's technique.

Indeed a cool idea!

BTW, we now have a TGA screenshot function in Horde3DUtils.

Page 1 of 1 All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
https://www.phpbb.com/