"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Screenshot won't taking 3D content

I'm using vuforia-sdk-ios-2-0-32. I referred below  link for taking screenshot (including both camera and 3D content) . https://developer.vuforia.com/forum/ios/vuforia-sdk-how-take-screenshots , https://developer.vuforia.com/forum/ios/take-screenshot . But my code taking only camera image and save to Album but it's not taking withoverlay content (3D content or image). My code:

ARParentViewController.mm :

-(void)screenshot:(id)sender{

 UIImage *outputImage = nil;

        CGFloat scale = [[UIScreen mainScreen] scale];

    CGRect  s = CGRectMake(0, 0, (768.0f) * scale, 1024.0f * scale);

 uint8_t *buffer = (uint8_t *) malloc(s.size.width * s.size.height * 4);

 glReadPixels(0, 0, s.size.width, s.size.height, GL_RGBA, GL_UNSIGNED_BYTE, buffer);

   CGDataProviderRef ref = CGDataProviderCreateWithData(NULL, buffer, s.size.width * s.size.height * 4, NULL);

     CGImageRef iref = CGImageCreate(s.size.width, s.size.height, 8, 32, s.size.width * 4, CGColorSpaceCreateDeviceRGB(), kCGBitmapByteOrderDefault, ref, NULL, true, kCGRenderingIntentDefault);

   size_t width = CGImageGetWidth(iref);

    size_t height = CGImageGetHeight(iref);

    size_t length = width * height * 4;

    uint32_t *pixels = (uint32_t *)malloc(length);

   CGContextRef context = CGBitmapContextCreate(pixels, width, height, 8, width * 4,

    CGImageGetColorSpace(iref), kCGImageAlphaNoneSkipFirst | kCGBitmapByteOrder32Big);

   CGAffineTransform transform = CGAffineTransformIdentity;

        transform = CGAffineTransformMakeTranslation(0.0f, height);

        transform = CGAffineTransformScale(transform, 1.0, -1.0);

        CGContextConcatCTM(context, transform);

        CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, width, height), iref);

        CGImageRef outputRef = CGBitmapContextCreateImage(context);

   outputImage = [UIImage imageWithCGImage: outputRef];

       CGDataProviderRelease(ref);

        CGImageRelease(iref);

        CGContextRelease(context);

        CGImageRelease(outputRef);

        free(pixels);

        free(buffer);

    UIImageWriteToSavedPhotosAlbum(outputImage, nil, nil, nil);

}

 

AR_EAGLView.mm:

 eaglLayer.drawableProperties = @{

                                    kEAGLDrawablePropertyRetainedBacking: [NSNumber numberWithBool:YES],

                                    kEAGLDrawablePropertyColorFormat: kEAGLColorFormatRGBA8,

      };

 

 

I downloaded vuforia 2-8-9 sample apps. And in Books app i did changes for taking screenshot. But still it's taking only camera image it won't taking camera image with augmented image content. I changes below code:

 

BooksEAGLView.mm :

I used same code for Books (Cloud Reco). But my button is not displaying. Does i have to change anything for books in BookEAGLView.mm file? 

Button is displaying now. But button click event is not working. I implemented code in ImageTargetEAGLView file.

ImgaeTargetEAGLView.h :

@interface ImageTargetsEAGLView : UIView <UIGLViewProtocol> {

I referred Trigger UIEvent from here https://developer.vuforia.com/resources/dev-guide/triggering-ui-events-when-target-detected and my button is able to receive touch event but overlay content is not storing only camera image storing.

If i use below code it automatically taking screenshot. Please help this.

 

- (BOOL)presentFramebuffer

{

     [self glToUIImage];