Forums > Jitter

lcd: drawsprite vs lineto

May 18, 2012 | 8:21 am

I’ve been toying with using a simple Max patch to record on screen mouse movements over time, similar to these: http://iographs.com/

To start, I’ve tried using the [lcd] object, but found that it’s not super happy about tracking the mouse when the patch window isn’t in the foreground. To get around that, I put in [mousestate] into a ‘lineto’ message. This seems to work pretty well, but the line it draws is noticeably jagged.

Instead I tried [mousestate] into a ‘drawsprite circle’ message. This gives me a nice line, but stops working as soon as the patch window isn’t in the foreground. Aside from that, I didn’t make any changes. Is there something about ‘drawsprite’ that requires the window to be in view?

I’ve been running the following patch in Presentation Mode, to track the entire screen (mine happens to be 1920×1080)…

– Pasted Max Patch, click to expand. –

May 21, 2012 | 11:06 pm

Thought I’d give this a little nudge… Has anyone had a chance to test the patch? Even if there isn’t an answer to my question, I’d be interested to know if someone else can confirm the behavior.


May 21, 2012 | 11:55 pm

you could use slide to smooth the jaggedness, but it creates a sort of latency–

– Pasted Max Patch, click to expand. –

you could get around this by sensing when the mouse stops after a certain amount of time and then with a metro banging a zl reg which contiains the most recent mouse position… a bit of a clumsy idea admittedly…


May 22, 2012 | 10:57 pm

Thanks for your suggestions, Terry. After giving your ideas a try, I found that I’m getting some kind of interference between the normal mouse-drawing-behavior of the [lcd] and inputting ‘lineto’ coordinates via [mousestate]. This screenshot is hopefully a better explanation than my rambling:

[attachment=194501,3921]

…what I think is happening is when the patch window is in the foreground, I’m getting smooth mouse drawing. When it isn’t in the foreground, the [lcd] is remember the last coordinate of mouse drawing, but then jumping between that and the incoming [mousestate] coordinates, creating the (admittedly kind of cool) triangular shapes.

– Pasted Max Patch, click to expand. –
Attachments:
  1. ScreenShot20120523at8.50.jpg

May 22, 2012 | 11:44 pm

that’s because you’re sending the lcd two lineto messages– one from the metro->mousestate and one from the lcd itself– and you don’t have the slide objects in there either…


May 23, 2012 | 1:02 am

Ahh, so that was embarrassingly simple: I was taking the idle mouse coordinates into the [lcd] and the slow metro into the [mousestate] was giving me the jagged lines.

Thanks again for your help, Terry.

– Pasted Max Patch, click to expand. –

Viewing 6 posts - 1 through 6 (of 6 total)