lineto (non-jaggy) alternative with jit.lcd?

jpg_mke's icon

Basically what I'm trying to do is allow people to write with a wacom tablet and dynamically record videos of them doing so, but I want it to resemble (as closely as possible) actual handwriting. Drawing (using default lineto) with jit.lcd (especially when the size of the lcd is increased) is jaggy as all get out. So I managed to enable drawing using paintoval but the difficulty now is creating continuous "lines". You'll notice if you move the mouse quickly it leaves big gaps - no good. I encountered the same problem with a simple processing sketch. Maybe I am going about this completely wrong, not sure.

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

Thanks!

carsol's icon

hi..
in the past i was doing something similar and i found the best solution with jit.gl.sketch and the stroke* commands..

theres many examples in the forum try searching for strokepoint or strokeparam

best!

jpg_mke's icon

Hi carsol,

Thank you for the reply, using jit.gl.sketch with the stroke attributes seems like it may be the solution. I came across an example in Jitter Recipes: Book 2:

but am unclear on a number of things (and apologies I'm a beginner):

1. Do the beginstroke, strokepoint and endstroke messages all need to be sent (and in this order) to draw a stoke/curve?
2. I understand that strokepoint is merely "an anchor point", so when where do I actually define the stroke/curve?
3. What is strokeparam order?

Also if you (or anyone) knows of (or would be willing to make) an easier example I would greatly appreciate it, this one's a bit complex for just trying to understand the basics of the object and attributes (imho).

Rob Ramirez's icon

also take a look at the jit.gl.path object (max 6 only)
might be slightly easier for you to implement than the gl.sketch stroke commands.

if you're adding lots of points, make sure you set the @segments attribute as small as possible (the more points in the path you provide, the fewer segments you'll need between those points to make the path look smooth).

Joshua Kit Clayton's icon

I would also consider looking at jit.mgraphics as an alternative to jit.lcd.

It's a little more complicated to use, but Darwin has a great JS based introduction to MGraphics as used from Javascript. Much of the same logic applies to jit.mgraphics used either in a patcher or in JS. You can also just use the ordinary JS MGraphics implementation and copy the final output to a matrix. Darwin's tutorials show this as well.

Julien Bayle's icon

exploring ways to create my modular framework to easily generate video based on JS (https://cycling74.com/forums/protofuses-video-generator-design ), reading here & there advices... I guess I now HAVE TO use JSUI/MGraphics implementation and popout matrix to jit.window even if the JSUI part itself wouldn't be used as UI element...

I mean, it seems the best/easy way to do what I want to do instead of jit.lcd or eventually JS manipulating jitter objects...