Trouble with multiple cams/viewports

I am having a bear of a time getting multiple views working to support a mode within my app where I must simulate focusing an old SLR camera.
My intent is to use two cameras and viewports: one pair to fill the top half of the screen and the other the lower half of the screen, affording the familiar split view.

I’ve been trying for hours, and have looked at the examples closely, but all the examples show viewports that have the same aspect ratio as the main screen.
I will show two examples – neither of which works. I’ve tried every other permutation I can think of. Nothing is doing it correctly.

One effort is to construct cameras with widths and heights matching my full screen size, and setting ViewPorts addressing a screen of 0->1 with origin in the lower left. Whiie this yields two viewports that fill upper and lower screen as I want, the world seen through it is distorted to be twice as wide in X (objects appear fat). That pseudocode is:

[java]
Camera cam;
ViewPort view;

// set up top camera and viewport
cam = new Camera(myApp.getWidth(), myApp.getHeight()); // full screen size
cam.setViewPort(0f, 1f, .5f, 1f); // top half
view = renderManager.createMainView(“Top”, cam); view.setClearFlags(true, true, true); view.attachScene(myRootNode);

// set up bottom camera and viewport
cam = new Camera(myApp.getWidth(), myApp.getHeight());
cam.setViewPort(0f, 1f, 0f, .5f); // bottom half
view = renderManager.createMainView(“Bottom”, cam); view.setClearFlags(true, true, true); view.attachScene(myRootNode);
[/java]

Another approach I’ve tried is to create Cameras with the actual dimensions they will be rendering into: Camera(mapApp.getWidth(), myApp.getHeight() / 2); This, however, causes the viewport that is supposed to be in the bottom HALF to be in the bottom QUARTER of the screen, and the one that should be in the top half lies in the second quarter from the bottom. Objects are also too fat – possibly by a factor of 2 or even 4 here.

[java]
Camera cam;
ViewPort view;

// set up top camera and viewport
cam = new Camera(myApp.getWidth(), myApp.getHeight() / 2);
cam.setViewPort(0f, 1f, .5f, 1f); // top half
view = renderManager.createMainView(“Top”, cam); view.setClearFlags(true, true, true); view.attachScene(myRootNode);

// set up bottom camera and viewport
cam = new Camera(myApp.getWidth(), myApp.getHeight() / 2);
cam.setViewPort(0f, 1f, 0f, .5f); // bottom half
view = renderManager.createMainView(“Bottom”, cam); view.setClearFlags(true, true, true); view.attachScene(myRootNode);
[/java]

I’ve tried countless variations, including having the setViewPort() parameters have distorted points lying outside the 0->1 range. I’ve found some that cause the RenderManager to resize my views unbidden. It’s frigging murder. How is this done?

Can someone dispel the mystery here and tell me the plain, literal answer to the following:

If my screen can be measured by app.getWidth() and app.getHeight(), what width and height should I be using in the constructor Camera(int width, int height), and what values should I use when calling Camera.setViewPort(float left, float right, float bottom, float top)?

tone

Edit: latest innovation is to do this:

[java]
// set up top camera and viewport
cam = new Camera(myApp.getWidth(), myApp.getHeight()); // full screen size
cam.setViewPort(0f, 1f, .5f, 1.5f); // FULL SCREEN SIZE, starting, however, at 0.5 in Y
view = renderManager.createMainView(“Top”, cam); view.setClearFlags(true, true, true); view.attachScene(myRootNode);

// set up bottom camera and viewport
cam = new Camera(myApp.getWidth(), myApp.getHeight());
cam.setViewPort(0f, 1f, -.5f, .5f); // FULL SCREEN SIZE, starting, however, at -0.5 in Y
view = renderManager.createMainView(“Bottom”, cam); view.setClearFlags(true, true, true); view.attachScene(myRootNode);
[/java]

I now have undistorted views of the world in both halves. I will need to see what teaks remain unfound.

tone

Ok… while it was not quite how I expected this, but the code above resolves this for me.

tone