I’m trying to create a “pip” viewport on the top 40% of the screen (but the full width of the screen)
this is my code right now
[java]
Camera cam2 = cam.clone();
cam2.setViewPort(0f, 1, 0.6f, 1);
ViewPort view2 = renderManager.createMainView("Top PIP", cam2);
view2.setBackgroundColor(MoreColorRGBA.CORNFLOWER_BLUE);
view2.setClearFlags(true, true, true);
view2.attachScene(rootNode);
[/java]
it positions it properly on the top 40% of my screen. however it is stretched… so i tried doing this…
[java]
cam2.setViewPort(0f, 1, 0.6f, 1);
cam2.resize(cam.getWidth(), Math.round(cam.getHeight() * 0.4f), true);
[/java]
what i ended up with was a still stretch viewport random placed about 60% the way down on my screen…
however if i do just this…
[java]
cam2.setViewPort(0f, 1, 0, 1);
cam2.resize(cam.getWidth(), Math.round(cam.getHeight() * 0.4f), true);
[/java]
then i get a viewport that is not stretched and takes up 40% of the screen, its almost perfect, but its on the BOTTOM of the screen…
ive tried all sorts of numbers for cam2.setViewPort() to show on the top 40% of the screen but it all resulted in something weird.
How can i get the viewport to do what i want?