I duplicated one of my existing textures for the purpose of using it as the rendertarget for Vuforia. I made it the rendertarget and all was well except the image showed up upside down. I simply rotated the image 180 degress on the x-axis and it showed perfectly. Not flipped or anything. Perfectly.
Then I built the project for iOS and now suddenly the video on spans around 90% of the width of the image and only 90% of the height of the image AND it is rotated 90 degrees. I thought perhaps that UIDeviceOrientation setting I had to set in Xcode to make the project build was the roblem but setting that to any value makes no difference. It is still rotated 90 degrees ccw and taking up only a percentage of the image... Why?
Maybe the fact that my device is locked to landscape but I am running an app in portrait only mode? Nope, unlocked it and it still does exactly the same. So I ask again, why? :(
I noticed the following in my Xcode logs. Perhaps this might prove insightful....
Can't add component because class 'PremiumObjectFactoryStarterBehaviour' doesn't exist!
StopQCAR
Setting Unity version 4.6.0
StartQCAR
2014-12-16 08:21:46.560 ProductName[359:69225] *** -[AVCaptureVideoDataOutput setVideoSettings:] - videoSettings dictionary contains one or more unsupported (ignored) keys: (
Height,
Width
)
2014-12-16 08:21:46.568 ProductName[359:69225] DEBUG/AR(359) UIView has CAEAGLLayer class
2014-12-16 08:21:46.569 ProductName[359:69225] DEBUG/AR(359) UIView does not respond to selector renderFrameQCAR
2014-12-16 08:21:46.570 ProductName[359:69225] DEBUG/AR(359) UIView has CAEAGLLayer class
2014-12-16 08:21:46.570 ProductName[359:69225] DEBUG/AR(359) UIView does not respond to selector renderFrameQCAR
2014-12-16 08:21:46.571 ProductName[359:69225] DEBUG/AR(359) Could not find a UIView with CAEAGLLayer layer class that responds to selector renderFrameQCAR
Ok, I think I understand better your issue;
in fact, there is no public API in the Vuforoia Unity Extension corresponding to the native QCAR::setRotation(QCAR::ROTATE_IOS_90);
In Unity you need to handle the "scaling" and the "rotation" aspects of the Camera in a different way;
the VideoTextureBehaviour.cs script included in the Bckground Texture Access sample is what you need to look at, as it contains both the "scaling" logic and the "rotation" logic that ensure a proper video texture maping in all orientations (including the Portrait case).
In particular, you'll want to have a look at:
As you'll be able to see, this sample allows rendering the video backgroundtexture correctly on a textured plane in all orientations by using the code above (note: by default the sample starts is Portrait mode). You should be able to re-use the same code with minor adapatations for you GUI texture too.