When subclassing GLKViewController
, it has two methods amongst others:
- (void)update
,- (void)glkView:(GLKView *)view drawInRect:(CGRect)rect
.Both of these methods seem to be called each frame. Documentation reads:
As an alternative to implementing a
glkViewControllerUpdate:
method in a delegate, your subclass can provide an update method instead. The method must have the following signature:
- (void)update;
Which one should I override in my code, and which of them should contain draw calls?
This thread answers this: Difference between glkView:drawInRect: and glkViewControllerUpdate:? OpenGL ES 2 - iOS
Quoting:
About update() The view controller calls its delegate’s glkViewControllerUpdate: method. Your delegate should update frame data that does not involve rendering the results to the screen.
About drawInRect: the GLKView object makes its OpenGL ES context the current context and binds its framebuffer as the target for OpenGL ES rendering commands. Your delegate method should then draw the view’s contents.