Log in or register to post comments

How to take screenshots

January 9, 2012 - 6:08pm #1

I "FrameMarker" You take a screenshot.

But while pictures are stored, and sisters have not seen any white image, the shutter will sound even more.

CGRect rect = [[UIScreen mainScreen] bounds];
UIGraphicsBeginImageContext (rect.size);
UIApplication * app = [UIApplication sharedApplication];
[app.keyWindow.layer renderInContext: UIGraphicsGetCurrentContext ()];

UIImage * img = UIGraphicsGetImageFromCurrentImageContext ();
UIGraphicsEndImageContext (); UIImageWriteToSavedPhotosAlbum (img, nil, nil, nil);

To resolve this problem do not know what to do.
Please Help
Thank you.

Re: How to take screenshots

January 17, 2012 - 3:47am #5

Hi DaProd,

I'm not clear what you mean by "The screen size is not adjusted" since that is not mentioned in the thread.

The code sample provided implements the screen capture as a single indivisible function, but has three phases: 1) read the buffer 2) convert the buffer 3) write the buffer. If you want to reduce the blocking of the render loop by this action then do steps 2) and 3) on a different thread.

This is getting a bit 'off-topic' for AR - I'd recommend looking at other iOS/OpenGL forums for further info about this - you'll find more examples.

Re: How to take screenshots

January 17, 2012 - 3:18am #4

I tried the method you pointed out MoSR and :
- The screen size is not adjusted.
- There is a lag when using the function glReadPixels with such a big range.

Is there a way to take a screenshot without lagging too much ?

DaProd

January 12, 2012 - 3:49pm #3

Hi MoSR,

Thanks so much!
Because of your problem could be solved!

You may want one.
I want it placed a button on the screen.
Questions about this issue again in a new thread.

Re: How to take screenshots

January 10, 2012 - 2:34am #2

Hi ISB,

I'm not clear what you mean by "and sisters have not seen any white image" but here's a few tips I've learnt with this function.

1) Retain the image and release it in the callback from UIImageWriteToSavedPhotosAlbum.

2) Keep image sizes to multiples of 32 pixels (using screen size should ensure that, and this constraint may be more relevent to glReadPixels in the example below)

3) I'm not sure why you even get a shutter sound - I never have (although it's a good idea) - are you playing this sound yourself? If so why you get the sound multiple times may be a clue to a problem with your code

4) I'm not certain that this method works with OpenGL views - a method that does is given here:

Saving screenshot of OpenGL ES content to the Photo Album

Log in or register to post comments