Capture the pixels from gl (pwindow) to undo and redo

MrMaarten's icon

Hi all,

I making a drawing application with undo and redo. I have a working implementation with matrices. Also offsetting to matrix and then resetting the jit.gl.sketch keeps the patch from becoming slow after drawing many lines.
The matrix I send to a texture/ videoplane so the drawing can continue.

The problem with this solution is that there is a slight pixel difference between the view render in the pwindow and the matrix, so after many a few dozen times of sending it back and forth from the videoplane texture and the matrix the drawn lines get fuzzier and fuzzier.

Although it is a nice time based effect, it is not what I am after. So I am looking for a better solution. I was thinking sending to texture immediately is maybe better.

But I can't get this to work with multiple textures and to_texture commands.

In the attached patch, if I click to_texture caphere1, draw, click to_texture caphere2, click reset, then the last drawing disappears. But if I refresh the buffer by clicking the fssa on an off on the pwindow, I see that actually the whole buffer has been erased!

I found out when I was working further on sending it sequentially to a different texture, but it seems not to work that way. What is the right way to achieve this?

Max Patch
Copy patch and select New From Clipboard in Max.

thanks