Storing window/viewport data

I’m almost done with my paint program (any ony listening ??).
Just acnt think of an optimal way to save screen data for my undo/redo fuctionality.

It’s fine if i had only vertices to store(that’s and old idea now).
But I have tools like a pencil, an airbrush and an eraser in my app.
How can I possibly implement undo/redo for that- one cannot imagine storing the entire screen in a buffer (the buffer would be huge), and also of storing all the vertices where the tools are applied (that set of vertices would be huge).

Any ideas geeks??

You could do either of these things, I’d think. The screen buffer would be big, but not that big. Unless you are editing huge images you are talking about 1MB images, so for five levels of undo, that’s only 5MB.

As for storing all the points that a pen hit on a draw. That’s a miniscule ammount of data. You could use a short int for each coordinate, so that’s four bytes per coordinate. At 100Hz sampling frequency (ball park guess) that’s several seconds before you use even 1K.

You store only the area affected by the bounding box of the edit, and you probably compress that area. Machines have 128 MB or more of memory these days; it’ll take a LONG TIME before you run out.

And this isn’t OpenGL related at all, btw.

Ok, now what about textures-
Do i store my editable region as textures, every time any action takes place, to take advantage of the fact that most apps nowadays use 16MB of texture memory or more( and hence probably increase the performance, due to better pipelining in the texturing area).

I don’t think it matters since graphics programs have had multi-level undo for a while. I assume it must be a solved problem and not particularly OpenGL-related.