App.restart() changes camera frustrum?

Hi,

I’m having a problem trying to change the resolution at runtime and keeping the same camera frustrum. It seems that whenever I call app.restart() to apply the resolution changes, the frustrum of the camera must revert back to some default value as well. Unfortunately I’m not sure how to get this property to stop it from changing. I can change the frustrum through input (after the new resolution has been applied) in the keyboard but obviously I would like this change to occur automatically. Does anyone have an idea?

Cheers

I think it does this because the camera width and height changes… therefore aspect potentially changes. I would think that near/far at least are preserved but I guess fov would get wiped out.

The easiest solution is probably to enqueue a callable with the application that resets the camera frustum. Do this right after you trigger the restart and the code should execute after the resolution has changed but before any other app state or control updates, etc…

1 Like

The frustum’s left and right values are modified.

See here:
http://code.google.com/p/jmonkeyengine/source/browse/trunk/engine/src/core/com/jme3/renderer/Camera.java#440

1 Like

The enqueuing fixed it, thanks a lot. I should also probably learn how to spell ‘frustum’.