I have an EAGLView that I modify in an animation, and the animation is controlled by NSTimer , which calls the draw function. When I resize an EAGLView , I need to adjust the projection for viewing in order to maintain the aspect ratio of the content. The draw function is as follows:
gameView.frame = newFrame; [gameView setFramebuffer]; [self updateProjection]; [gameView presentFramebuffer];
To accomplish this, however, the contents of the EAGLView seem to be "stepped" down the animation. When I record it and look at it frame by frame, it clearly indicates that the projection is adjusted, and then the image will be changed a very short time later (less than one frame of animation).
I suspect the reason is that the change in the gameView frame gameView delayed, and in the meantime, the updated framebuffer breaks through to the screen. I tried using CATransactions to update the frame right away, but since I was as if expecting a UIView change, it did nothing. I suppose I can change the EAGLView and leave a full EAGLView frame, but I am worried that this may leave me with synchronization problems elsewhere (say, with updates for any overlaid CALayers).
Does this sound like a reasonable assessment of the problem? How can I prevent this β that is, how can I better make sure that the framebuffer view matches the change in the actual EAGLView frame (and other CA elements)?
Thanks!
source share