Log in or register to post comments

Loading slideshow problems

February 6, 2013 - 4:13am #1

Hi,

I tried to change a bit CloudReco sample, so that I can show a slideshow insted of one image. Ended up with various wrong results:

- on target it's showing one slide, off target another one... this is the most frequent situation. Do I have to do something extra to be able to show norml slideshow insted of one resource? I made a method to switch slides, but I ended up with static image (slide #1) on target and static image off target (slide #3).... any idea?

I have a NSMutableDictionary in my Content class (equvalent of Book class) and in TargetOverlayView I have methods for firing up NSTimer and changing slides...

Loading slideshow problems

March 13, 2013 - 8:05am #14

btw, if it helps, I'm using QCAR SDK version 2.0.29

Loading slideshow problems

March 13, 2013 - 6:07am #13

nope, setOverlayLayer stayed as it was - I didn't want to mess with EAGLView

Loading slideshow problems

March 13, 2013 - 5:44am #12

Have you tried changing the code within setOverlayLayer() ?

N

Loading slideshow problems

March 13, 2013 - 4:52am #11

I mean, how hard can it be to just change texture on the run - whatever if you tap, set timer or anything else - I don't believe that you don't have ways, to simply change texture without loosing & reacquiring target.... ~~ firing up setOverlayLayer deletes old and the dance starts all over again :/

Loading slideshow problems

March 13, 2013 - 2:31am #10

edit:

bookCover image is updating! Whole TargetOverlayView is updating too, but when I point ON target every update inside TargetOverlayView makes 3d stuff, shown on a plane, dissappear - so I have to repeat steps: targetLost -> targetReacquired....

 

Loading slideshow problems

March 12, 2013 - 8:40am #9

If I understand correctly, you are saying that the texture defined in TargetOverlayView:

 

self.bookCoverImageView.image

 
...does not update.

 

I would suggest breaking this problem down to 1) find out why not  2)  how you can fix it and  3) how to integrate it into your app.

For 1) and 2) one thing you could try is tapping on it to change the image and see if it updates instantly (you could do this fairly quickly).

For 3) if you have not tried it already add an Observer/Notification like this in the ViewDidLoad method at the end:

 

    [[NSNotificationCenter defaultCenter]

     addObserverForName:kMyNotification object:nil

           queue:[NSOperationQueue mainQueue]

      usingBlock:^(NSNotification *notification) {

          

          // update image here

 

      }];

 

... and see if this works when a programmatic change is triggered outside.

 

Hope this is helps.

N

 

 

 

Loading slideshow problems

March 12, 2013 - 8:13am #8

I did wrap it in two places actaully:

  1. when slide was changed I sent notification, so CROverlayViewController knows to fire up reload method, which looks like this:
    - (void)reloadOverlay:(NSNotification*)notification{
        // reload targetoverlay
        dispatch_async(dispatch_get_main_queue(), ^{
            NSLog(@"CROVC: reloadOverlay");
            [self.arViewController setOverlayLayer:self.targetOverlayView.layer];
            [self.targetOverlayView setHidden:YES];
        });
    }
  2. part of loadSlides method, where based on displaymode I run different updates on displayed content

All I got, is finding target - but not displaying from the beginning image ON TAREGET, I have to loose target, then reacquire it. And like this with every next change of slides. Old plane disappears -> target lost -> content image pops up off target -> aim device on target -> target reacquired -> show on plane the proper slide image...

Is there anyway, to update texture without hiding plane?

Loading slideshow problems

March 5, 2013 - 5:00am #7

Shouldn't changes inside TargetOverlayView change what arViewController is showing?

Not necessarily - as I mentioned there can be cases whereby views fail to update - not quite sure I can enumerate all these.

One other question.  When you carry out your updates inside your TargetOverlayView, have you tried wrapping them up in 

dispatch_async(dispatch_get_main_queue()

...to ensure they update on the main thread?

 

N

 

 

 

Loading slideshow problems

March 5, 2013 - 4:02am #6

So, one thing you could try is to send the view a notification so that it updates itself rather than something updating it.

But the problem is that I am updating inside labels, UIImageViews etc inside TargetOverlayView - this seemed to be the easiest way to start. Just modify TargetOverlayView, so I wouldn't be interfering with your project sample too much and let Vuforia do the job... which is not happening

The other possibility might be to wrap up those updating calls into a method that gets called by performSelectorOnMainThread(), because if you are making any changes in renderFrameQCAR() then you need to bear in mind that this is running on a background thread.

I didn't change anything yet inside renderFrameQCAR() - as I said I wanted 'just' to modify, so the hard job of rendering and placing images on plane (on target) would be done by Vuforia sample itself.

My concern is about part where project knows that the target was found (dedicated method called from notification). There is this call:

[self.arViewController setOverlayLayer:self.targetOverlayView.layer];

I have feeling that because of this line I'm missing something. Shouldn't changes inside TargetOverlayView change what arViewController is showing? The moment I create Content object earlier and assign it to the targetOverlayView object all timers and scheme of how to display content are before assinging its layers to arViewController. Hope I make it a bit clearer.

Loading slideshow problems

March 4, 2013 - 10:29am #5

In my experience UIViews can be slow to update if you set any IBOutlet / member outside the actual class/object.  I have seen this when decoding JSON outside a UIView  and then calling setNeedsLayout().  That did not work and the solution there was to send the UIView a notification so it decoded the JSON itself and updated UILabels by itself - then the changes happened instantly rather than taking 5 seconds or so

So, one thing you could try is to send the view a notification so that it updates itself rather than something updating it.

The other possibility might be to wrap up those updating calls into a method that gets called by performSelectorOnMainThread(), because if you are making any changes in renderFrameQCAR() then you need to bear in mind that this is running on a background thread.

HTH

N

Loading slideshow problems

March 4, 2013 - 7:47am #4

actually, I'm trying to implement scrollView inside TargetOverlayView, but still no success :( can anyone tell me one thing for now: how to force ON target overlay, to refresh its content from time to time - it is working OFF target, but ON it's a mess. I know that on Android it can be achieved, so surely there is a way to do taht on iOS...

Loading slideshow problems

February 28, 2013 - 6:49am #3

I did try - still nothing... I tried to create new method with notification, so TargetOverlayView will call every time new slide is coming up - still not working.

- (void)reloadOverlay:(NSNotification*)notification{
    // reload targetoverlay
    NSLog(@"CROVC: reloadOverlay");
    [self.arViewController setOverlayLayer:self.targetOverlayView.layer];
    [self.targetOverlayView setHidden:YES];
}

 

I don't get it how to refresh this "on target" layer... :/

Loading slideshow problems

February 7, 2013 - 6:36am #2

Hi chwastek

Just wondering whether you might be better off by changing the code in CROverlayViewController.mm

... as this controls the view - if you look at the code you can see where sets up the book cover and uses timers etc.

You may need to experiment a bit because there is a lot to the sample.

HTH

N

 

Log in or register to post comments