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,
};
Screenshot won't taking 3D content
I'm using vuforia-sdk-ios-2-0-32
Sorry, older versions of the SDK are not supported.
N
Screenshot won't taking 3D content
ok thanks...then does my code is correct in putting ARParentViewController.mm file or i need to setup somewhere?
Screenshot won't taking 3D content
How can i use older version code to newer version?
Screenshot won't taking 3D content
You need to follow the upgrade guides:
https://developer.vuforia.com/resources/dev-guide/migrating-your-ios-sdk-project
..and older if required:
https://developer.vuforia.com/forum/ios/migrating-your-project-vuforia-159-vuforia-sdk-2x
N
Screenshot won't taking 3D content
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 :
Screenshot won't taking 3D content
I'm using iPadMini iOS 6.1
Screenshot won't taking 3D content
In order to take a screenshot in the ImageTarget Application, which lives within the Vuforia Samples application, the code below will capture a screenshot containing the video feed as well as the augmentation when a button is pressed
Screenshot won't taking 3D content
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?
Screenshot won't taking 3D content
I cannot tell you that - you need to work some things out for yourself.
What I suggest is that you try what I suggested below with Image Targets a s astarting point to learn.
Then, once it works try it with the books app.
Persistence is crucial.
N
Screenshot won't taking 3D content
Button is displaying now. But button click event is not working. I implemented code in ImageTargetEAGLView file.
ImgaeTargetEAGLView.h :
@interface ImageTargetsEAGLView : UIView <UIGLViewProtocol> {
Screenshot won't taking 3D content
Does TargetOverlayView (invisible overlay view) hiding the button touch event?
Screenshot won't taking 3D content
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.
Screenshot won't taking 3D content
This is nothing to do with Vuforia - you simply need to diagnose what the problem is and fix it.
N
Screenshot won't taking 3D content
If i use below code it automatically taking screenshot. Please help this.
- (BOOL)presentFramebuffer
{
[self glToUIImage];
Screenshot won't taking 3D content
I'm using iPadMini iOS 6.1.