By twerdster
on Wed, 06/20/2012 - 17:07
[B]URGENT - WE NEED THIS MOCKUP READY IN 36 HOURS[/B]
Hi
I am trying to do something which I assumed would be very simple but for some reason is not working.
I have taken the image targets sample and added a viewcontroller.
So I have 3 additional files
MenuScreenViewController.h
MenuScreenViewController.mm
MenuScreenViewController.xib
They are directly added by the apple UIViewController option.
I then put a single button in the xib and link it to a simple function in the view controller:
[CODE]- (IBAction)runAR:(id)sender
{
ImageTargetsAppDelegate *appDelegate = (ImageTargetsAppDelegate *)[[UIApplication sharedApplication] delegate];
[self presentModalViewController: [appDelegate viewController] animated:YES];
[[appDelegate view] onResume];
}[/CODE]
The view controller has default oreintation i.e
[CODE]- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}[/CODE]
I have edited the UIApplicationDidFinishLaunching like this:
[CODE]- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
BOOL ret = YES;
CGRect screenBounds = [[UIScreen mainScreen] bounds];
window = [[UIWindow alloc] initWithFrame: screenBounds];
view = [[EAGLView alloc] initWithFrame: screenBounds];
viewController = [[ARViewController alloc] init];
[viewController setView:view];
MenuScreenViewController *menuViewController = [[MenuScreenViewController new] retain];
window.rootViewController = menuViewController;
[window makeKeyAndVisible];
[menuViewController release];
if (YES == ret) {
[view onCreate];
}
return ret;
}[/CODE]
On my iPhone4 this opens up the viewcontrollers menu screen and displays the button and shows the following log:
[CODE]2011-11-19 06:20:11.990 ImageTargets[7520:707] QCAR OpenGL flag: 2
2011-11-19 06:20:12.181 ImageTargets[7520:707] EAGLView onCreate()
2011-11-19 06:20:12.263 ImageTargets[7520:4103] INFO: QCAR SDK version 1.0.3
2011-11-19 06:20:12.327 ImageTargets[7520:4103] WARNING: -[ setMinFrameDuration:] is deprecated. Please use AVCaptureConnection's -setVideoMinFrameDuration:
2011-11-19 06:20:12.277 ImageTargets[7520:707] EAGLView onResume()
2011-11-19 06:20:12.588 ImageTargets[7520:4103] QCAR::init percent: 100
2011-11-19 06:20:12.593 ImageTargets[7520:5f03] INFO: Tracker starts loading
2011-11-19 06:20:12.618 ImageTargets[7520:5f03] INFO: Found config.xml
2011-11-19 06:20:12.758 ImageTargets[7520:5f03] WARNING: The aspect ratio of target CocaCola varies considerably from the aspect ratio of its image (2.640 vs. 2.500)
2011-11-19 06:20:12.764 ImageTargets[7520:5f03] INFO: Found config.xml
2011-11-19 06:20:12.772 ImageTargets[7520:5f03] INFO: Tracker finished loading (no errors)
2011-11-19 06:20:12.779 ImageTargets[7520:707] WARNING: -[ setMinFrameDuration:] is deprecated. Please use AVCaptureConnection's -setVideoMinFrameDuration:
[/CODE]
I then press the button and the view changes immediately ( no animation?) to the camera output. When I point the camera at the marker it doesnt display the object but displays the following log
[CODE]2011-11-19 06:22:15.746 ImageTargets[7520:707] EAGLView onResume()
2011-11-19 06:22:15.748 ImageTargets[7520:707] INFO: UIView has CAEAGLLayer class
2011-11-19 06:22:15.751 ImageTargets[7520:707] INFO: UIView conforms to UIGLViewProtocol
2011-11-19 06:22:15.755 ImageTargets[7520:707] INFO: UIView has CAEAGLLayer class
2011-11-19 06:22:15.759 ImageTargets[7520:707] INFO: UIView conforms to UIGLViewProtocol
2011-11-19 06:22:15.927 ImageTargets[7520:2d9b] active trackables: 0
2011-11-19 06:22:16.021 ImageTargets[7520:2d9b] active trackables: 0
2011-11-19 06:22:16.057 ImageTargets[7520:2d9b] active trackables: 0
2011-11-19 06:22:16.095 ImageTargets[7520:2d9b] active trackables: 0
2011-11-19 06:22:16.121 ImageTargets[7520:2d9b] active trackables: 1
after EAGLView renderFrameQCAR() glError (0x502)2011-11-19 06:22:16.164 ImageTargets[7520:2d9b] active trackables: 1
after EAGLView renderFrameQCAR() glError (0x502)2011-11-19 06:22:16.257 ImageTargets[7520:2d9b] active trackables: 1
after EAGLView renderFrameQCAR() glError (0x502)2011-11-19 06:22:16.293 ImageTargets[7520:2d9b] active trackables: 1
after EAGLView renderFrameQCAR() glError (0x502)2011-11-19 06:22:16.348 ImageTargets[7520:2d9b] active trackables: 1[/CODE]
When I check where the OpenGL error is it says I find it occurs immediately after the following line in EAGLView.mm
[CODE]glUniformMatrix4fv(mvpMatrixHandle, 1, GL_FALSE, (const GLfloat*)&modelViewProjection.data[0]);[/CODE]
Why is this not working ?!!! Why can I not see the teapot? Is this the correct way to display qcar?
The only thing I can think of is that the MenuScreenViewController and ARViewController have different orientations. Is this the problem? How can I fix it in the above code?
Re: Problem with QCAR view controller
Re: Problem with QCAR view controller
Re: Problem with QCAR view controller
Re: Problem with QCAR view controller