Absolutely perfect!
Thank you so much, EgonOlsen! You have been a tremendous help!
To sum everything up:
Thank you so much, EgonOlsen! You have been a tremendous help!
To sum everything up:
Code Select
// create the FrameBuffer at half the width of the actual window
mFrameBuffer = new FrameBuffer(gl, w/2, h);
// compute your FOV values (using the aspect ratio of the actual window)
float xFOV = SOME_CHOSEN_VALUE;
float yFOV = 2.0f * Math.atan( Math.tan(xFOV * 0.5f) * h/w );
// tell the camera to render at the aspect ratio of the actual window, not the aspect ratio of the frame buffer
com.threed.jpct.Config.autoMaintainAspectRatio = false;
Camera cam = world.getCamera();
cam.setFOVLimits(LOWER_LIMIT, HIGHER_LIMIT); // I wanted a narrow FOV, so I found that I needed to change my FOV limits
cam.setFOV( (float) Math.atan( xFOV ) );
cam.setYFOV( (float) Math.atan( yFOV ) );
// ... when it comes time to render ...
cam.setPosition( LEFT_EYE_POSITION );
cam.lookAt( TARGET_POSITION );
com.threed.jpct.Config.viewportOffsetX = 0.0f;
world.renderScene(fb);
world.draw(fb);
cam.setPosition(RIGHT_EYE_POSITION );
cam.lookAt( TARGET_POSITION );
com.threed.jpct.Config.viewportOffsetX = 1.0f;
world.renderScene(fb);
world.draw(fb);
fb.display();