Log in or register to post comments

- (void)renderFrameQCAR not called

September 13, 2011 - 12:47am #1

Hi!

I'm trying to integrate the ImageTarget EAGLView in a Navigation Based Application in XCode 4.
Using the xib editor, I set EAGLView as the view of the RootViewController.

Everything seems working except I have to explicitly call - (void)renderFrameQCAR (using a CADisplayLink for example) in order for the sample to work.

Any idea of what I could be doing wrong? I don't have any error message from QCAR, it's just that renderFrameQCAR is not called by the framework.

FYI, here's the log:

2011-09-13 09:32:54.257 POC-RA PSA-iPad[346:707] QCAR OpenGL flag: 2
2011-09-13 09:32:54.262 POC-RA PSA-iPad[346:707] EAGLView onCreate()
2011-09-13 09:32:54.288 POC-RA PSA-iPad[346:707] updateApplicationStatus: 1
2011-09-13 09:32:54.306 POC-RA PSA-iPad[346:707] updateApplicationStatus: 2
2011-09-13 09:32:54.319 POC-RA PSA-iPad[346:707] EAGLView onResume()
2011-09-13 09:32:54.319 POC-RA PSA-iPad[346:6003] INFO: QCAR SDK version 1.0.3

2011-09-13 09:32:54.471 POC-RA PSA-iPad[346:6003] QCAR::init percent: 100
2011-09-13 09:32:54.474 POC-RA PSA-iPad[346:707] updateApplicationStatus: 3
Current language:  auto; currently objective-c++
2011-09-13 09:33:03.399 POC-RA PSA-iPad[346:707] updateApplicationStatus: 4
2011-09-13 09:33:03.400 POC-RA PSA-iPad[346:1607] INFO: Tracker starts loading

2011-09-13 09:33:03.432 POC-RA PSA-iPad[346:1607] INFO: Found config.xml

2011-09-13 09:33:03.533 POC-RA PSA-iPad[346:1607] INFO: Found config.xml

2011-09-13 09:33:03.540 POC-RA PSA-iPad[346:1607] INFO: Tracker finished loading (no errors)

2011-09-13 09:33:03.542 POC-RA PSA-iPad[346:707] updateApplicationStatus: 5
2011-09-13 09:33:03.545 POC-RA PSA-iPad[346:707] updateApplicationStatus: 7
2011-09-13 09:33:04.285 POC-RA PSA-iPad[346:707] CameraImpl: setting focus mode 2 is not supported
2011-09-13 09:33:04.288 POC-RA PSA-iPad[346:707] CameraImpl: setting torch mode 0 is not supported
2011-09-13 09:33:04.296 POC-RA PSA-iPad[346:707] StartCamera

Thanks!

Re: - (void)renderFrameQCAR not called

December 15, 2011 - 7:17am #25

Harsh - this is the correct behaviour - what you are seeing is the last displayed frame. You'll need to remove or hide the view if you want this to be removed.

Re: - (void)renderFrameQCAR not called

December 15, 2011 - 7:14am #24

the camera view freezes...

The log is as follows:

GNU gdb 6.3.50-20050815 (Apple version gdb-1705) (Fri Jul 1 10:53:44 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
GDB is free software, covered by the GNU General Public License, and you are
welcome to change it and/or distribute copies of it under certain conditions.
Type "show copying" to see the conditions.
There is absolutely no warranty for GDB. Type "show warranty" for details.
This GDB was configured as "--host=x86_64-apple-darwin --target=arm-apple-darwin".tty /dev/ttys000
target remote-mobile /tmp/.XcodeGDBRemote-21481-41
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
[Switching to process 11779 thread 0x0]
[Switching to process 11779 thread 0x0]
sharedlibrary apply-load-rules all
2011-12-15 20:33:53.304 FlightFear[1823:707] cnt value is 3
2011-12-15 20:34:02.769 FlightFear[1823:707] QCAR OpenGL flag: 2
2011-12-15 20:34:02.772 FlightFear[1823:707] EAGLView onCreate()
2011-12-15 20:34:02.827 FlightFear[1823:7007] INFO: QCAR SDK version 1.0.0

2011-12-15 20:34:03.080 FlightFear[1823:7007] QCAR::init percent: 100
2011-12-15 20:34:03.119 FlightFear[1823:700b] INFO: Tracker starts loading

2011-12-15 20:34:03.143 FlightFear[1823:700b] INFO: Found config.xml

2011-12-15 20:34:03.232 FlightFear[1823:700b] INFO: Found config.xml

2011-12-15 20:34:03.238 FlightFear[1823:700b] INFO: Tracker finished loading (no errors)

2011-12-15 20:34:03.242 FlightFear[1823:707] INFO: UIView has CAEAGLLayer class

2011-12-15 20:34:03.244 FlightFear[1823:707] INFO: UIView conforms to UIGLViewProtocol

2011-12-15 20:34:04.000 FlightFear[1823:707] CameraImpl: setting focus mode 2 is not supported
2011-12-15 20:34:04.002 FlightFear[1823:707] CameraImpl: setting torch mode 0 is not supported
2011-12-15 20:34:14.269 FlightFear[1823:707] EAGLView onPause()

Re: - (void)renderFrameQCAR not called

December 15, 2011 - 5:53am #23

"It doesn't work" - can you give me some more to go on? Does the camera stream stop? Does it go static? Does the augmentation dissappear? Do you get anything in the log? (When asking a question on the forum, put yourself in the shoes of the 'listeners').

Re: - (void)renderFrameQCAR not called

December 15, 2011 - 5:42am #22

Hi MoSR,

One more question: I want to close the AR/camera view on click of a button (on overlay view). I tried onPause() but it doesn't work? can you guide me in the right direction?

Regards,
Harsh

Re: - (void)renderFrameQCAR not called

December 15, 2011 - 2:39am #21
harshmathur wrote:

Thanks for your help MoSR. This came through.
I created a method in the AppDelegate to initialize the EAGLView, with code similar to one in the sample App.

This works!

Well persevered, harshmathur. :-)

Re: - (void)renderFrameQCAR not called

December 14, 2011 - 4:36am #20

Thanks for your help MoSR. This came through.
I created a method in the AppDelegate to initialize the EAGLView, with code similar to one in the sample App.

This works!

Re: - (void)renderFrameQCAR not called

December 13, 2011 - 3:05am #19
harshmathur wrote:

What else should i be doing here?

Comparing the log with the sample app's log? ;-)

Re: - (void)renderFrameQCAR not called

December 9, 2011 - 10:44am #18

Great..That fixes the build errors!
However, that does no help to bringing up the OpenGL model.

On click of the button, I'm calling onResume method of EAGLView. What else should i be doing here?

Re: - (void)renderFrameQCAR not called

December 9, 2011 - 10:30am #17

You need to rename your file to FirstPage.mm as you are including QCAR headers that have C++ constructs in them.

.m = Objective-C only
.cpp = C++ only
.mm = combined C++ and Objective-C

Re: - (void)renderFrameQCAR not called

December 9, 2011 - 10:12am #16

I have updated the link with the changed files.
Here is the link again fro your reference:
http://linkmyportfolio.com/files/ImageTargets01.zip

Re: - (void)renderFrameQCAR not called

December 9, 2011 - 10:07am #15

I did as you recommended. I create the view in appDelegate, call onCreate, followed by onPause to ensure that Camera is stopped.
Now in my view FirstPage -> openView method, I try to get a reference to the EAGLView from the appDelegate as:

*ImageTargetsAppDelegate *appDelegate = (ImageTargetsAppDelegate *)[[UIApplication sharedApplication] delegate];
* *
* *EAGLView* view = [appDelegate getView];
* *[view onResume];

This (even importing ImageTargetAppDelegate) in FirstPage causes build errors in EAGLView and Matrices.h. Errors like
"Type name requires a specifier or qualifier"

These errors go away if I remove the code for appDelegate from my view (FirstPage).

Re: - (void)renderFrameQCAR not called

December 9, 2011 - 7:50am #14

AFAIK, you cannot reassign self in an instance method. I'm surprised it's not caused more problems.

-(void)openview{
    CGRect screenBounds = [[UIScreen mainScreen] bounds];
    
    CGRect viewBounds;
    viewBounds.origin.x = 0;
    viewBounds.origin.y = 0;
    viewBounds.size.width = screenBounds.size.height;
    viewBounds.size.height = screenBounds.size.width;
    self = [[EAGLView alloc] initWithFrame: viewBounds];
    
    [self onCreate];
    [self onResume];
}

You could create the view in a Class method +(EAGLView*)method... and return the class to something else.

But why not create the view in the appDelegate, call onCreate on it (and maybe onPause to make sure the camera is stopped), and leave it hidden or unattached to the view hierarchy until you call openView, when you unhide it, or stitch it into the view hierarchy, and call onResume on it.

Can I recommend that you get what you want working without QCAR (with a normal UIView) then replace that with an EAGLView and fire up QCAR. Then you know you've got a working iOS view model before adding complexity.

Re: - (void)renderFrameQCAR not called

December 9, 2011 - 7:28am #13

I am using the Teapot OpenGL.
Though I have added code to the Delegate and added a method to EAGLView.

Here is the link to the project:
http://linkmyportfolio.com/files/ImageTargets01.zip

I appreciate your continued help and guidance!

Re: - (void)renderFrameQCAR not called

December 9, 2011 - 7:15am #12

You have an OpenGL error. There is something wrong with your data or use of OpenGL state.

It looks like there's nothing wrong with your target or tracking.

Re: - (void)renderFrameQCAR not called

December 9, 2011 - 7:11am #11

I understand that in a normal app, I do not get the error messages i see here in the end when the Tracker image is recognized. However, in my code, it does not show the model. I tried to play some music once the tracker image is recognized and that worked fine. But no model come.

Here is the log:

target remote-mobile /tmp/.XcodeGDBRemote-709-75
Switching to remote-macosx protocol
mem 0x1000 0x3fffffff cache
mem 0x40000000 0xffffffff none
mem 0x00000000 0x0fff none
[Switching to process 7171 thread 0x1c03]
[Switching to process 7171 thread 0x1c03]
sharedlibrary apply-load-rules all
2011-12-09 19:50:06.969 ImageTargets[928:707] QCAR OpenGL flag: 2
2011-12-09 19:50:11.298 ImageTargets[928:707] QCAR OpenGL flag: 2
2011-12-09 19:50:11.300 ImageTargets[928:707] EAGLView onCreate()
2011-12-09 19:50:11.370 ImageTargets[928:707] EAGLView onResume()
2011-12-09 19:50:11.398 ImageTargets[928:4607] INFO: QCAR SDK version 1.0.0

2011-12-09 19:50:11.459 ImageTargets[928:4607] WARNING: -[ setMinFrameDuration:] is deprecated. *Please use AVCaptureConnection's -setVideoMinFrameDuration:
2011-12-09 19:50:11.660 ImageTargets[928:4607] QCAR::init percent: 100
2011-12-09 19:50:11.698 ImageTargets[928:6703] INFO: Tracker starts loading

2011-12-09 19:50:11.803 ImageTargets[928:6703] INFO: Found config.xml

2011-12-09 19:50:11.940 ImageTargets[928:6703] INFO: Found config.xml

2011-12-09 19:50:11.948 ImageTargets[928:6703] INFO: Tracker finished loading (no errors)

2011-12-09 19:50:11.950 ImageTargets[928:707] INFO: UIView has CAEAGLLayer class

2011-12-09 19:50:11.955 ImageTargets[928:707] INFO: UIView conforms to UIGLViewProtocol

2011-12-09 19:50:11.960 ImageTargets[928:707] WARNING: -[ setMinFrameDuration:] is deprecated. *Please use AVCaptureConnection's -setVideoMinFrameDuration:
[Switching to process 10243 thread 0x2803]
[Switching to process 10243 thread 0x2803]
Current language: *auto; currently objective-c++
after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)[Switching to process 10243 thread 0x2803]
after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)[Switching to process 7171 thread 0x1c03]
[Switching to process 7171 thread 0x1c03]
after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)[Switching to process 10243 thread 0x2803]
[Switching to process 10243 thread 0x2803]
after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)after EAGLView renderFrameQCAR() glError (0x502)[Switching to process 7171 thread 0x1c03]
[Switching to process 7171 thread 0x1c03]
kill
quit

Re: - (void)renderFrameQCAR not called

December 9, 2011 - 6:00am #10

It would be helpful if you provided the log for QCAR startup. Without that I can't help you.

If you are using your own target, swap out with a target from a sample app, to elimate the possibility of a target problem.

Your view hierarchy should be something like:

Window
+- EAGLView
+- xib view
        +- button

(BTW your attachments didn't come through - maybe send a private message instead?)

Re: - (void)renderFrameQCAR not called

December 9, 2011 - 5:14am #9

Thanks for your reply!

I suspect that the Tracker is not loading. I see the camera view on press of the button, but it odes not recognize tracker images.

Please help how can i add multiple views in a xib, as you recommend.
For you reference I have attached the AppDelegate, EAGLView and my view (FirstPage) file. Please help me here.

I am really pressed against time here.

Best regards,
Harsh

Re: - (void)renderFrameQCAR not called

December 9, 2011 - 4:20am #8

What I would do at this point is to run the original ImageTargets sample and compare the log output to see what I'm missing. That may reveal the cause - look for the following:

QCAR OpenGL flag: 2
EAGLView onCreate()
INFO: QCAR SDK version 1.0.0
EAGLView onResume()
QCAR::init percent: 100

INFO: Tracker starts loading
INFO: Found config.xml
INFO: Found config.xml
INFO: Tracker finished loading (no errors)

INFO: UIView has CAEAGLLayer class
INFO: UIView conforms to UIGLViewProtocol

Note that I'm not sure that EAGLViews like having other views (the button) as children. You'd be safer having a parent view (or the root Window) that contained both the EAGLView and the button as siblings. (Yes, the Dominoes sample app does add a view with buttons from a xib to an EAGLView but it's wise to avoid that as they can be tempramental).

Re: - (void)renderFrameQCAR not called

December 8, 2011 - 11:01am #7

Hi,

Thanks for your reply!
Here is my scenario, I have an existing iOS app in which i want to integrate Image Targets.
I have a view with a button. On click of this I want to open the AR Camera view.

I have made the EAGLView (from Image Targets) as the Owner of the view in the xib, and called the onCreate method of click of this button. This opens the camera view alright. But it does not recognize the tracking images.

Please help me with an example for a similar scenario.

Best regards,
Harsh

Re: - (void)renderFrameQCAR not called

December 5, 2011 - 2:47am #6

Hi harshmathur,

Currently we provide the Getting Started Guide and the sample projects - your request for an integration guide for existing projects has been noted.

Essentially you need to look in renderFrameQCAR for QCAR calls and the way that the samples access the detected targets.

You need to make sure you've invoked onCreate() when you want QCAR ready for use (and onDestroy() when done), and onResume() and onPause() to start and stop the camera capture and target detection, and of course implemented a renderFrameQCAR in your EAGLView, which must be in the view hierarchy when onResume() is called.

Re: - (void)renderFrameQCAR not called

December 2, 2011 - 7:35pm #5

Thanks for the very useful tip!

I'm a newbie here, and struggling with lot of build errors. It would be useful if you could point me to a "how to guide" for integrating, say Image Targets sample, in a navigation based Xcode 4 project.

Re: - (void)renderFrameQCAR not called

September 14, 2011 - 7:08am #4

Good find! - indeed if QCAR:: onResume() isn't being called QCAR won't even try to find your EAGLview. :-)

Re: - (void)renderFrameQCAR not called

September 13, 2011 - 3:17am #3

From what you pointed out I could solve the issue by moving the call to
QCAR::onResume() from RootViewController::viewWillAppear: to RootViewController::viewDidAppear:

Thanks for your help!

Sebastien

Re: - (void)renderFrameQCAR not called

September 13, 2011 - 2:47am #2

Hi sdelaroq,

Looking at your log, it differs from the usual with a missing pair of lines:

INFO: UIView has CAEAGLLayer class
INFO: UIView conforms to UIGLViewProtocol

This suggest that the view hierarchy is not correctly built up - QCAR navigates the window.subviews to find the EAGLview.

= Martin =

Log in or register to post comments