ofCamera & ipad Horizontal orientation

First issue, ofCamera inverts everything. This was confusing at first but with some scaling it works.
Second, also need rotate 90 degrees to get the camera into landscape mode.
Mostly, this is annoying, which leads me to believe I’m doing something wrong and ofCamera really isn’t this bizarre.
I also can’t figure out dolly (moving on the z axis). No matter which way, either using cam.dolly() or cam.setPosition() and changing the z axis, nothing changes. I can pan around on the x y just fine.

Here’s what I’m trying to do. I’m drawing a large background grid with an FBO (ofFBO also seems to have some issues with iPhone/iPad as well, but some simple scaling and rotating also fixes). Users can then draw on the grid, but every point snaps to a grid point. two finger swipe to scroll around the gird and pinch / pull for zooming (dollying) in and out. I think I’ll need to use pointPicker for aligning things to the grid and later allowing for touch interaction with the shapes drawn, but I’m not going to tackle that till I get the camera sorted.

If anyone can offer some advice or has an example I could take a look at that’d be awesome.

here’s the pertinent parts

  
  
  
void testApp::setup(){	  
  
    cam.setNearClip(-1);  
    cam.setFarClip(-100);  
    cam.enableOrtho();  
      
    camPos.set(backgroundGrid.width/2, backgroundGrid.height/2, -1);  
    cam.setPosition(camPos); //place camera in the center of the grid to start with  
}  
  
void testApp::draw(){  
    cam.begin();  
    ofPushMatrix();  
    ofScale(1, -1, 1);  // using a camera flips everything upside down, so we need to flip it back  
    ofRotateZ(-90); //also need to rotate to account for ipad orientation, super annoying  
    backgroundGrid.draw();  
    ofPopMatrix();  
    cam.end();  
}  
void testApp::touchMoved(ofTouchEventArgs &touch){  
  
/***********************  
This bit is a kind of out of context, but works for panning around and the values I get back from Z go between -1, -100  
**************************/  
  
        ofPoint move;  
        move = twoMove(touches[0].x, touches[0].y, touches[1].x, touches[1].y, origGesture);  
          
        camMovePos = camPos - move;  
          
        // Note, I swap x and y because of the stupid camera reversing itself  
        if (camMovePos.x < 0) {camMovePos.x = 0;}  
        if (camMovePos.y < 0) {camMovePos.y = 0;}  
        if (camMovePos.y > 2288) {camMovePos.y = 2288;}  
        if (camMovePos.x > 3056) {camMovePos.x = 3056;}  
          
        cam.setPosition(camMovePos.y, camMovePos.x, camMovePos.z);  
//        cam.dolly(move.z);  
}  
  

This recent addon may be useful for you. It does pan/zoom for iOS.

https://github.com/armadillu/ofxPanZoom

Wow, thanks. This is fantastic! Basically everything I was doing, but embarrassingly better in every way…