Changing application's aspect ratio

Hi folks, I’ve inherited an application that uses LWJGL and jMonkeyEngine and am beginning to add some developments to it, but have hit a bit of a brick wall.

Part of the functionality is to export animations to video clips, and it does this by printing each frame to an offscreen renderer, exporting as a jpg then using ffmpeg to join them all up. We have the ability to select different video sizes to export to, and this is done by applying a scale factor to each object in the scene i.e.

x_scale = offscreenrenderer.getwidth() / display.getwidth()

object1.getNode().getLocalTranslation().x *= x_scale;


This works fine if the aspect ratio is the same. The app is 800x600 by default, so outputting to any other 4:3 resolution is ok, but when a 16:9 ratio like 1280x720 is selected the objects on screen are slightly out of place. I’ve been thinking this over for a while now, and I think it should be really simple to convert to 16:9, but I just can’t figure it out.

Does anyone have any idea what the best way of doing this would be?

Thanks in advance,


You might want to take a look at this:,%20float,%20float,%20float)

Note also that jMonkeyEngine now has its own video capture app state that you can simply add to an application to get it to record video directly. Eventually this might be something you want to look at as it avoids some extra steps.