Log in or register to post comments

Best way to invoke another viewcontroller from EAGLView thread

November 12, 2012 - 2:35pm #1

What is the recommended way to invoke another viewController from the AR View, eg after after a target is tracked.

For example I have put the ARView in a tab based app. Changing tabs works fine when doing it via the UI but if I want to do it programmatically from the ARView I very often experience the QCARUtils hangs:


2012-11-12 22:58:50.933 SpikedReality_v2[15720:907] <0x1dd75040 ARViewController.mm:(124)> ARVC: viewDidDisappear
2012-11-12 22:58:50.935 SpikedReality_v2[15720:907] <0x1ddbcc00 QCARutils.mm:(235)> QCARutils onPause()
2012-11-12 22:58:50.936 SpikedReality_v2[15720:907] <0x1ddbcc00 QCARutils.mm:(332)> APPSTATUS_CAMERA_STOPPED


and then it just hangs in the mainthread locking up the enture gui:


Other times it works fine:


012-11-12 23:03:28.581 SpikedReality_v2[15763:907] <0x2109c980 ARViewController.mm:(124)> ARVC: viewDidDisappear
2012-11-12 23:03:28.582 SpikedReality_v2[15763:907] <0x21049fe0 QCARutils.mm:(235)> QCARutils onPause()
2012-11-12 23:03:28.583 SpikedReality_v2[15763:907] <0x21049fe0 QCARutils.mm:(332)> APPSTATUS_CAMERA_STOPPED

2012-11-12 23:03:28.918 SpikedReality_v2[15763:907] ARParentVC: dissappeared
2012-11-12 23:03:28.919 SpikedReality_v2[15763:907] <0x2109c980 ARViewController.mm:(124)> ARVC: viewDidDisappear

Please suggest a pattern to use here....





Best way to invoke another viewcontroller from EAGLView thread

November 13, 2012 - 3:54am #2

Hi tgotzsche

If you are using the existing structure as per the samples, then in ImageTargets when the user double taps a screen it shows an overlay controller, as you can see from the line below in ARParentViewController.m

        [overlayViewController showOverlay];

You should be able to use this type of mechanism to overlay/call another view controller.

Part of the reason that there are problems is because the rendering is carried out within a background thread, so you may need to use PerformSelectorOnMainThread to overcome any problems here.

Below are a few threads that mention this, plus an example of how to use it.









[self performSelectorOnMainThread:@selector(showMessage:) withObject:message waitUntilDone:NO];






Log in or register to post comments