Im just starting to look at Open GL ES for iOS and I'm looking through the source code on apples template code. The problem is both
- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
and
- (void)update
are being called, but I'm unable to determine by what and how to change the frequency?
glkView is called automatically when the view needs to be updated.
According to Apple "A GLKView object uses the regular view drawing cycle for a UIView object, calling its drawRect: method whenever the contents of the view need to be updated."
You can use a GLKViewController to set the framerate of the glkview like this:
- (void)viewDidLoad
{
self.preferredFramesPerSecond = 60;
}
Update is also called automatically for you before the rendering. You can use this call to update variables such as the locations of your drawn objects - but you may want to use the timeSinceLastUpdate property because the time elapsed between calls can vary.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With