-2

I am trying to develop a drawing/painting app for my portfolio.

The functions I have now are "Write", "Change Size", and "Change Color".

Now, I am trying to implement an eraser tool that will totally erase what's written. What I did so far was copy the same code I used for writing, using white as the color, but instead of erasing what's written it just overwrites the first one. Is that the right way, or is there another way to implement this?

G A
  • 67
  • 2
  • 13
chano
  • 21
  • 1
  • 8
  • 1
    Exact duplicate of: http://stackoverflow.com/questions/4048811/erase-using-brush-in-glpaint – CodaFi Nov 08 '11 at 04:40

1 Answers1

0

I don't honestly know too much about OpenGL as of this writing, but I suspect that painting over with white is the wrong thing to do. Consider what happens if you decide to allow users to change the background color. The your code gets a little more complicated. What if you decide to add support for gradients?

I suggest finding a way to simply clear the data at a given point, for example, where your brush is. You might want to look at an open source graphics program, like GIMP, to see how they do it.

Moshe
  • 57,511
  • 78
  • 272
  • 425