I'm writing an iOS game that uses OpenGL ES 2.0. I have my 'OpenGLView' which contains a
- (void)setupDisplayLink {
CADisplayLink* displayLink = [CADisplayLink displayLinkWithTarget:self selector:@selector(render:)];
[displayLink addToRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode];
}
And then my
- (void)render:(CADisplayLink*)displayLink {
function which at the end of the processing calls
[_context presentRenderbuffer:GL_RENDERBUFFER];
Like most people I've found the http://gafferongames.com/game-physics/fix-your-timestep/ tutorial but I've been thinking.
With a CADisplayLink, has the framerate limiting been done for me already by iOS, meaning I don't need to calculate the timing of each frame?
Also, as a sanity check, the 'render' function is where all my game logic goes? I'm currently treating it as the equivalent of a
while (!quit) {
do_stuff();
render();
}
loop you see in traditional game loop designs, or is this only for rendering?