The app I’m developing is landscape only. I have it setup as so through the Xcode project settings.
On boot the viewport and touch positioning is out by 90 degrees. Once you rotate the iPad it fixes the issue. I have tried setting ofSetOrientation() on the first frame of update() but that doesn’t work, the only thing that kicks it into working properly is physically rotating the iPad
I’ve been scratching my head on this one for a while now, and it’s driving me a bit batty! Any hints of ways to look into this, or better still a solve would be greatly appreciated!
I think I ran into this too on my last app.
I think I both set it via the settings as @mkrebs mentioned but also via the Xcode properties
Something like this but selecting just the orientations you want.
I also think it is good to note that the OF orientation does not correspond to the physical orientation. ie: OF_ORIENTATION_90_LEFT is Landscape Right ( I believe ).
I have setup the Xcode settings as above (but for the the orientation as landscape). I have also set the main.mm up as above (as well as experimenting with different variations).
OF doesn’t know what orientation the device is in on launch (ofGetWidth() & Height don’t provide a distinction either), as such, half of the time (dependent on whether my ofSetOrientation() call matches the device orientation) the viewport and touch coords are out by 90 degrees until a rotation happens.
The nightly build was the same, I have started a conversation with @danoli3 around paying him to resolve this issue, and would appreciate assistance as needed to get the solve included into core OF for future OF builds
Ok, so… I have a workaround…
this will allow you to have a landscape only app on iPad, it will start in default, and then on rotation of device the screen will rotate (but without animation)
int main() {
// here are the most commonly used iOS window settings.
//------------------------------------------------------
ofiOSWindowSettings settings;
settings.enableRetina = true; // enables retina resolution if the device supports it.
settings.enableDepth = false; // enables depth buffer for 3d drawing.
settings.enableAntiAliasing = true; // enables anti-aliasing which smooths out graphics on the screen.
settings.numOfAntiAliasingSamples = 4; // number of samples used for anti-aliasing.
settings.enableHardwareOrientation = false; // enables native view orientation.
settings.enableHardwareOrientationAnimation = false; // enables native orientation changes to be animated.
settings.glesVersion = OFXIOS_RENDERER_ES2; // type of renderer to use, ES1, ES2, etc.
settings.windowControllerType = ofxiOSWindowControllerType::GL_KIT; // Window Controller Type
settings.colorType = ofxiOSRendererColorFormat::RGBA8888; // color format used default RGBA8888
settings.depthType = ofxiOSRendererDepthFormat::DEPTH_NONE; // depth format (16/24) if depth enabled
settings.stencilType = ofxiOSRendererStencilFormat::STENCIL_NONE; // stencil mode
settings.enableMultiTouch = true; // enables multitouch support and updates touch.id etc.
ofCreateWindow(settings);
return ofRunApp(new ofApp);
}