Log in or register to post comments

"the given camera is invalid" on iOS 6 / iPad 3

September 25, 2012 - 3:25pm #1

I'm integrating QCAR into one screen of a Cocos2d project by adding an ARParentViewController as a subview of the shared director view. Everything builds properly but when I get to that screen in my app, QCAR inits and then shuts down with the error message "Failed to register callback because the given camera is invalid".

The device is an iPad 3 on iOS 6 and sample code works fine on the device. My first thought is that cocos2d is doing something with the camera that makes it unavailable to other SDKs. I'm not personally interacting with the camera anywhere else in the app.

Any other ideas?

Relevant logs:

2012-09-25 15:22:23.213 App[267:907] ARVC: loadView

2012-09-25 15:22:23.234 App[267:907] QCAR OpenGL flag: 2

2012-09-25 15:22:23.236 App[267:907] ARVC: viewDidLoad

2012-09-25 15:22:23.238 App[267:907] QCARutils onCreate()

2012-09-25 15:22:23.240 App[267:907] APPSTATUS_INIT_APP

2012-09-25 15:22:23.241 App[267:907] APPSTATUS_INIT_QCAR

2012-09-25 15:22:23.244 App[267:907] ARParentVC: loading

2012-09-25 15:22:23.246 App[267:907] ARParent: Rotating to Landscape Right

2012-09-25 15:22:23.248 App[267:907] ARParentVC: appearing

2012-09-25 15:22:23.250 App[267:907] ARParent: Rotating to Landscape Right

2012-09-25 15:22:23.251 App[267:907] ARVC: viewWillAppear

2012-09-25 15:22:23.253 App[267:907] ARVC: viewWillAppear

2012-09-25 15:22:23.268 App[267:907] cocos2d: surface size: 2048x1536

2012-09-25 15:22:23.279 App[267:907] EAGLView: layoutSubviews

2012-09-25 15:22:23.286 App[267:907] ARVC: viewDidAppear

2012-09-25 15:22:23.288 App[267:907] QCARutils onResume()

2012-09-25 15:22:23.290 App[267:907] ARParentVC: appeared

2012-09-25 15:22:23.292 App[267:907] ARVC: viewDidAppear

2012-09-25 15:22:23.296 App[267:907] QCARutils onDestroy()

2012-09-25 15:22:23.307 App[267:6903] INFO/AR(267) 2012-09-25 15:22:23: QCAR SDK version 1.5.9

2012-09-25 15:22:23.308 App[267:907] ERROR/AR(267) 2012-09-25 15:22:23: Failed to register callback because the given camera is invalid.

2012-09-25 15:22:23.313 App[267:907] cocos2d: deallocing <CCScaleTo = 0x11833d0 | Tag = -859111423>

2012-09-25 15:22:23.422 App[267:6903] ERROR/AR(267) 2012-09-25 15:22:23: Failed to initialize because this device has no valid camera.

"the given camera is invalid" on iOS 6 / iPad 3

September 27, 2012 - 10:20am #5

Nope, I can't figure out why that occurs from within cocos2d. It doesn't occur when you use the same code but place the view outside of the cocos2d container.

"the given camera is invalid" on iOS 6 / iPad 3

September 27, 2012 - 1:44am #4

Thanks for sharing.

Did you solve the OnDestoy() issue?

N

"the given camera is invalid" on iOS 6 / iPad 3

September 26, 2012 - 12:51pm #3

There are some weird issues with the camera when trying to display from within cocos2d. I don't think I can fully debug them from the outside of QCAR.

In the meantime, you have to do two things to work around it: if you're using a class named EAGLView (such as the examples are) you need to rename it. There's a (deprecated in 2.0+) class in cocos2d that is named the same thing and it conflicts. Secondly, the camera weirdness when attempting to display the EAGLView inside of a cocos2d view by adding it as a subview of the shared director. Instead, use your root navigation controller to push the ARParentViewController onto the navigation stack, then pop it off to return to cocos2d when you're done.

"the given camera is invalid" on iOS 6 / iPad 3

September 26, 2012 - 2:50am #2

Hi Nick,

If the sample code works fine then it must be the integration.

Just looking at your log the thing that stands out is this line:

QCARutils onDestroy()

...which basically means that Vuforia is shutting down, so something in your app must be triggering this.

My hunch is if you can find why this is happening you should be on your way to sorting the problem.

BTW very interested in your approach to integrating with Cocos2D.  You might need to think about the use of EAGL contexts, as well in case there are any conflicts that might arise.

Please let me know how you get on.

N

Log in or register to post comments