Login  Register

Re: write/convert JOGL animation to .mov or .wmv or ogg

Posted by Demoscene Passivist on Mar 04, 2012; 7:00pm
URL: https://forum.jogamp.org/write-convert-JOGL-animation-to-mov-or-wmv-or-ogg-tp3798456p3798713.html

U can use the utility class com.jogamp.opengl.util.awt.Screenshot. With the method Screenshot.readToBufferedImage() u can read the rendered image back from the GPU and convert it to a BufferedImage.

Stg like this:
BufferedImage tScreenshot = Screenshot.readToBufferedImage(0,0, getScreenWidth(), getScreenHeight(),false);

The BufferedImage can then be easily writte to a PNG:
ImageIO.write(inBufferedImage, "png", tScreenCaptureImageFile);

Do that for every frame and u get an image-sequence. Name them "image_0000.png"-"image_1000.png". The images can then be easily converted with ffmpeg or mencoder.

U may take a look at my repository for a couple of batch scripts that do the conversion.