Login  Register

Re: mouse input

Posted by Wade Walker on Nov 13, 2011; 4:51pm
URL: https://forum.jogamp.org/SOLVED-mouse-input-tp3504609p3504762.html

One possible problem is the recentering of the mouse via Robot -- doing that in the MouseMotionListener could generate a cascade of mouse move events (since the event handler is generating more of the same type of event). Try turning off recentering to see what effect it has on your smoothness.

Another possibility: maybe the non-smooth motion is due to the fact that a mouse position change has to go through two threads (maybe three) before it has an effect on the rendered scene:

- (AWT GUI thread): save dx, dy
- (input thread): apply dx, dy to camera matrix
- (rendering thread?): draw scene

The time between mouse move and screen update could vary unpredictably between 1 and 3 times the maximum thread period  And this is the best case -- if the AWT event queue gets too full, clearing out the backlog may introduce further variation in update times.

I'd try removing at least the input thread -- let the MouseMotionListener change the camera matrix directly. It may take some tweaking to get a multithreaded app to render smoothly. Without knowing exactly how you've designed it, it's hard to say for certain.