Search code examples
opengl-esframe-rate

How can I tell OpenGL how often to draw stuff?


Okay, I'm going to sound like an idiot with this one. Here goes.

I've been doing iOS development for about a year now, but only tonight have I started doing anything OpenGL related. I've followed Jeff LaMarche's wonderful guide and I'm drawing a neat looking triangle, and I got it to flip around and stuff. I'm one entertained programmer.

Okay, here's the stupid question part: How can I set somewhere for OpenGL to perform glRotatef and glDrawArrays + friends continuously, or at a set frames per second? I've tried Googling it, but really can't come up with good search terms.

Thanks in advance, and get ready to field a ton more of these questions.


Solution

  • You should read up on the concept of game loops.

    http://entropyinteractive.com/2011/02/game-engine-design-the-game-loop/ is a good resource to get you started.