I’m currently working on an app that allows the user to draw pixelated images using OpenGL ES, but I don’t know how to implement an undo function.
How could I do it? I thought of using an image for every pixel and adding it to an array. Basically, how can I store the rectangles I use as pixels?
I’m currently working on an app that allows the user to draw pixelated images
Share
you can try :
clear old
bufferremove point from
array;render
display
bufferother solution:
You can grab an image from OpenGL ES context everytime you draw something and save in application’s bundle as image file. This saves application’s run memory.
When undo is pressed you just draw previous saved image into the context and that’s it.
See OpenGL ES Simple Undo Last Drawing