title: OpenGL: How to implement an "eraser" tool?
body: <p>I'm working on a game for the iPhone that has a drawing/paint mechanic involved and I'm having problems trying to create a tool that would erase things already painted.</p>
  
  <p>The main problem is that the background being painted on is not a solid color but a static image or animation. I've tried using different blending options and logical operations in drawing but nothing seemed to work. I'm new to OpenGL so I must be missing something.</p>
  
  <p>Any tips?</p>
  
  <p>EDIT: To give a little more information, I'm using textures for my brushes and using glVertexPointer() and glDrawArrays() to render them. For example:</p>
  
  <pre><code>glBindTexture(GL_TEXTURE_2D, circleBrush);
  glVertexPointer(3, GL_FLOAT, 0, verts);
  glTexCoordPointer(2, GL_FLOAT, 0, coords);
  glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
  </code></pre>
  
  <p>EDIT 2: Unfortunately, stencil buffers are not available on the iPhone. : (</p>
  
  <p>EDIT 3: Framebuffer objects are available on the iPhone and that is the road I took. I haven't fully implemented it yet, but so far it looks like it works the way I wanted it to. Thanks everyone!</p>