ofxiPhoneSetOrientation odd behavior

Has anyone used the ofxiPhoneSetOrientation in 062? It seems that in landscape the rotation is switched (down is up and up is down) and upside down is blank (transformation is blank - no opengl showing).

For example, in testApp.mm put:

void mainApp::deviceOrientationChanged(int newOrientation){  
      ofxiPhoneSetOrientation( (UIDeviceOrientation)newOrientation );  

This should rotate the view every time the device is rotated. For me, in landscape, the buttons drawn on bottom are now on top (opposite where they should be) and upside down doesn’t show anything (black screen). Also, if the device is tilted a bit or level on a table, then it does something with with the glview and stretches it out in one direction as if it’s unsure which is height and which is width.

The code on github is significantly different and since it doesn’t compile I can’t test if it fixes this issue.

Anyone have experience with this or is there a ofxiPhone github version that someone has working?

Ok, looks like I missed the post that fixes the upside down orientation:


And I fixed the ‘weird’ orientation when it’s flat by putting an if statement

if(newOrientation == 5){ //rotate to new view }  

Since ‘5’ is returned for ‘face up’ orientation I guess.

I haven’t figured out why the landscape height are rotated differently for me though. Top is bottom and bottom is top.

A note for other 062 users, I’m not sure if it’s just me or not, but in ofxiPhoneExtras, OFXIPHONE_ORIENTATION_LANDSCAPE_RIGHT and OFXIPHONE_ORIENTATION_LANDSCAPE_LEFT should be switched. In my application, the orientations are opposite of what they should be when using setOrientation.

This solved all the above issues for me.