title: OpenGL ES Simple Undo Last Drawing
body: <p>I am trying to figure out how to implement a simple "undo" of last drawing action on the iPhone screen.  I draw by first preparing the frame buffer:</p>
  
  <pre><code>[EAGLContext setCurrentContext:context];
  glBindFramebufferOES(GL_FRAMEBUFFER_OES, viewFramebuffer);
  </code></pre>
  
  <p>I then prepare the vertex array and draw this way:</p>
  
  <pre><code>glVertexPointer(2, GL_FLOAT, 0, vertexBuffer);
  glDrawArrays(GL_POINTS, 0, vertexCount);
  glBindRenderbufferOES(GL_RENDERBUFFER_OES, viewRenderbuffer);
  [context presentRenderbuffer:GL_RENDERBUFFER_OES];
  </code></pre>
  
  <p>How do I simple undo this last action?  There has to be a way to save previous state or an built-in OpenGL ES function, I would think.</p>
  
  <p>Thanks</p>