Help needed with jit.gl.sketch and layers

MrMaarten's icon

Hi!

Im new to Jitter. Read sa much from the forum as possible, but I could use a little advise on this one.

I am making a drawing patch for an installation. Im using stroke in jit.gl.sktech, modified from the forum.

But the new lines that are drawn are below the old lines. I tried to solve this with layers, but that doesn't seem to work within one jit.gl.sketch object (sending multiple stroke command with different layer numbers does nothing).

Turns out the layer only work if I use seperate sketch objects. But since I want to use the layers as an undo system (deleting the layer), it's not so handy to have X number of sketch objects for each layer.
Generating objects of the fly is also something I dont know how to do so...

What would be the best approach for this?

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

here is my patch I simplified a bit for this example, sorry if it is a bit messy. Still a beginner :)

thanks in advance

carsol's icon

hi.. for the overlaping issue you just need to turn off the depth_enable of the gl.sketch.

good luck with the project!

MrMaarten's icon

hey thanks! that did the trick indeed!

too bad the layers don't work in jit.gl.sketch

Im thinking now to make my undo system with the mouse positions that are recorder each time there is a mouse down and then redraw everything minus one when 'undo' is pressed.
I hope that performs fast enough...

Or is there a way to erase a specific stroke? Im also wondering that in relation to building something like a eraser but that's maybe not possible with vector based drawing like this.

Thanks,
Maarten