Changing application's aspect ratio

Started by ajr_1, January 09, 2012, 15:04:38

Previous topic - Next topic

ajr_1

Hi folks,  first post so hopefully this is in the right place.

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;
object1.updateGeometricState

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,
Alan