Log in or register to post comments

How to capture screenshot of overlay image

May 29, 2014 - 6:05am #1

I can able to capture the render teapot but i can't able to capture some other images on overlay. I'm displaying some images while camera view load then after scanning the teapot rendering but i cant take the screenshot of teapot but i the overlay image is not saving.  The cat & tiger images are not saving only teapot is saving.

ImageTargetsEAGLView.mm :

- (void)DisplayPhotoButton


    UIImageView *imgView = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 100, 50)];

imgView.image = [UIImage imageNamed:@"cat.png"];

[self.view addSubview: imgView];   

UIImageView *imgView1 = [[UIImageView alloc] initWithFrame:CGRectMake(50, 100, 100, 50)];

imgView1.image = [UIImage imageNamed:@"tiger.png"];

[self.view addSubview: imgView1];  



- (id)initWithFrame:(CGRect)frame appSession:(SampleApplicationSession *) app


    self = [super initWithFrame:frame];


    if (self) {

        vapp = app;

    if (YES == [vapp isRetinaDisplay]) {

            [self setContentScaleFactor:2.0f];


         // Load the augmentation textures

        for (int i = 0; i < NUM_AUGMENTATION_TEXTURES; ++i) {

            augmentationTexture[i] = [[Texture alloc] initWithImageFile:[NSString stringWithCString:textureFilenames[i] encoding:NSASCIIStringEncoding]];


 // Create the OpenGL ES context

        context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES2];

          // The EAGLContext must be set for each thread that wishes to use it.

        // Set it the first time this method is called (on the main thread)

        if (context != [EAGLContext currentContext]) {

            [EAGLContext setCurrentContext:context];


          // Generate the OpenGL ES texture and upload the texture data for use

        // when rendering the augmentation

        for (int i = 0; i < NUM_AUGMENTATION_TEXTURES; ++i) {

            GLuint textureID;

            glGenTextures(1, &textureID);

            [augmentationTexture[i] setTextureID:textureID];

            glBindTexture(GL_TEXTURE_2D, textureID);

            glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);

            glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

            glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, [augmentationTexture[i] width], [augmentationTexture[i] height], 0, GL_RGBA, GL_UNSIGNED_BYTE, (GLvoid*)[augmentationTexture[i] pngData]);


 offTargetTrackingEnabled = NO;

    [self loadBuildingsModel];

     [self initShaders];

         _takePhotoFlag = NO;        

      [self DisplayPhotoButton];


  return self;


How to capture screenshot of overlay image

June 4, 2014 - 12:24am #2

You may want to check this:


the technique described in that article is based on the use of glReadPixels().  But you would need to render your overlay images (cat & tiger) in OpenGL, otherwise this won't work.

In any case, strictly speaking, this is nothing to do with the Vuforia SDK, so you may want to also search for this in other Forums.


Log in or register to post comments