When looking at the GLCameraRipple example, the AVCaptureVideoDataOutput is setup in such a way that a callback is called (captureOutput) whenever a new frame arrives from the iphone camera.
However, putting a "sleep(1)" at the beginning of the "drawInRect" function (that is used for OpenGL drawing), this callback gets called only 1 time per second, instead of 30 times per second.
Can anyone tell me why the framerate of the iphone camera is linked with the framerate of the OpenGL draw call?
Update: Steps to reproduce
- Download the GLCameraRipple sample from here: http://developer.apple.com/library/ios/#samplecode/GLCameraRipple/Introduction/Intro.html
- In RippleViewController.m => captureOutput, add a
NSLog(@"Got Frame");
. Running it will generate a lot of "Got Frame" messages (about 30 per second) - In RippleViewController.m => drawInRect, add a
sleep(1);
at the very beginning of the function. Only one message per second appears now.