Hi there i was making Paint Brush kind of thing which Draws some basic shapes in glcontrol
now i want to add Undo Option, I Really donot have idea how will this work so please give me any Hint
First thing to understand: OpenGL is just a drawing API. You send drawing commands and it will just change the colour of some pixels in the target framebuffer. There's no high level functionality in OpenGL that abstracts geometry into manipulateable objects. This is what a scene graph does.
A undo/redo history requires to store all the drawing operations in a separate structure, a linked list of drawing operations for example.
Each new operation is appended to the list. Undoing would be implementing by going back steps. Any new operation after some undo steps would discard the tail and build a new one.
On the OpenGL side you could either redraw the whole list after an Undo/Redo, or for every step store the state of framebuffer; this however would eat up a lot of memory so storing just the differences, and using some simple compression scheme (runlength and prior segmenting into tiles) saves memory.