We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpSyntax Questions › Mouse movement resolution
Page Index Toggle Pages: 1
Mouse movement resolution (Read 535 times)
Mouse movement resolution
Oct 7th, 2008, 2:16pm
 
Hi there,


Started with Processing not a long time ago, and creating a real time illustration application I have found a problem. Basically I am drawing ellipses en each mouseX and mouseY position under MousePressed and running at about 900 fps.

I have found that the mouseX and mouseY values are not updated fast enough when moving the mouse fast in the screen, which results in the ellipses being drawn separated from one another if the mouse moves too fast.

Is there a way to update the values of the mouse coordinates in a faster way like accessing the Java code directly, or should I use another way like drawing curves and interpolating the points, for example?


Thanks so much for your help!



Fernán.-
Re: Mouse movement resolution
Reply #1 - Oct 7th, 2008, 7:17pm
 
Whilst your sketch might be running at 900fps, your operating system is unlikely to be polling the mouse position anywhere near that fast.
Re: Mouse movement resolution
Reply #2 - Oct 8th, 2008, 3:36am
 
use the mouseMoved() event to get every mouse move event that's passed in from the system:
http://processing.org/reference/mouseMoved_.html
when used inside draw(), mouseX/Y are only updated once per trip through draw().

but like johng says, you're not gonna get "exact" mouse movement with no gaps, no operating system does that.
Re: Mouse movement resolution
Reply #3 - Oct 8th, 2008, 11:06am
 
You're still going to have to some interpolation yourself no matter what.
Page Index Toggle Pages: 1