title: Separating OpenGL Calls from Updating on the iPhone
body: <p>I'm a bit of a newb when it comes to threading, so any pointers in the right direction would be a great help. I've got a game with both a fairly heavy update function, and a fairly heavy draw function. I'd assume that the majority of the weight in the draw function is going to happen on the GPU. Because of this, I'd like to start calculating the update on the next frame while the drawing is happening. Right now, my game loop is quite simple:</p>
  
  <pre><code>Game-&gt;Update1();
  Game-&gt;Update2();
  Game-&gt;Draw();
  </code></pre>
  
  <p><code>Update1()</code> updates variables that do not change game state, so it can run independently from Draw. That is to say, there should be no fights over data between the two. It is also the bulk of the CPU processing.</p>
  
  <p><code>Update2()</code> updates variables that Draw needs, and it is quite fast, so it seems right to have it running serially with <code>Draw()</code>. Additionally, I believe that the <code>Draw()</code> function is light on CPU and heavy on GPU.</p>
  
  <p>What I would like to happen is that while the GPU is busy processing all the Draw functionality, the next frame's Update1() can use the CPU to get the next frame's update ready. It doesn't seem like I'm automatically getting this functionality -- the Draw cycle seems to take a little while and block everything until it's done, which is less than ideal. </p>
  
  <p>What's the proper way to do this? Is this already happening, and I'm just not observing it properly?</p>