Seemingly at random (but typically consistent during any given program run), my presentRenderBuffer
call is very slow. I tracked it down to a call to glFlush()
which presentRenderBuffer
makes, so now I call glFlush()
right before presentRenderBuffer. I put a timer on glFlush()
, and it does one of two things, seemingly at random.
glFlush()
either
1) consistently takes 0.0003 seconds
OR
2) alternates between about 0.019 and 0.030 seconds
The weirdest thing is, this is independent of drawing code. Even when I comment out ALL drawing code so that all it does is call glClear()
, I still just randomly get one of the two results.
The drawing method is called by an CADisplayLink
with the following setup:
dLink = [[UIScreen mainScreen] displayLinkWithTarget:viewController selector:@selector(drawFrame)];
dLink.frameInterval = 1;
[dLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
I'm finding it impossible to pin down what causes one of the results to occur. Can anyone offer ideas?