Create an ofCamera based on default openFrameworks view/projection

Is there an easy way to create an ofCamera object that matches the default view/projection of openFrameworks?

I see there is a function called ofCamera::setupPerspective(vFlip, fov, nearDist, farDist, lensOffset) but I’m not sure how to grab those settings from the “default camera” in openFrameworks.

Basically, I want to use the default settings most of the time and every now and then trigger an animation where the camera jerkily dollies before coming back to rest at the default settings.

Here’s what I tried so far, I’m trying to recreate what I see in ofGLProgrammableRenderer::setupScreenPerspective():

float fov = 60.0;                                                                                                                                                            
float eyeY = ofGetHeight()/2;
float eyeX = ofGetWidth()/2;
float halfFov = PI * fov / 360.0;
float theTan = tanf(halfFov);
float dist = eyeY / theTan; 
float aspect = ofGetWidth() / ofGetHeight();

float nearDist = dist / 10.0;
float farDist = dist * 10.0;

camera_.setupPerspective(true, fov, nearDist, farDist, ofVec2f(0.0, 0.0));
camera_.move(eyeX, eyeY, dist);

And the results:

And here is the same scene without using an ofCamera:

Did I screw up some of the camera math? Is there a simpler way to copy over the default perspective settings?

i use these functions to save and load the camera position.

 void camLoadPos(string _filename){
    //grabcamera setup
    //grabcam position
    //read in default 3d view
    ofFile inFile;".mat", ofFile::ReadOnly, true);*) defaultPosition.getPtr(), sizeof(float) * 16);
    cout<<"load camera position"<<endl;

void camSavePos(string _filename){
    //bCamSavePos = !bCamSavePos;
    defaultPosition = cam.getGlobalTransformMatrix();
    ofFile outFile;".mat", ofFile::WriteOnly, true);
    outFile.write((char*) defaultPosition.getPtr(), sizeof(float) * 16);
    cout<<"save camera position"<<endl;