Login  Register

[SOLVED] mouse input

Posted by kaesemeister on Nov 13, 2011; 3:15pm
URL: https://forum.jogamp.org/SOLVED-mouse-input-tp3504609.html

Hi,

I currently implementing camera control via mouse in a usual first person way. My current solution works but the camera rotation is not smooth :( I gues it's because I use AWT functions to read the mouse position. I've read some articles and some of them use GLUT to handle the mouse motion:

glutPassiveMotionFunc and glutMotionFunc

Unfortunately I can't find these functions in com.jogamp.opengl.util.gl2.GLUT.

Here is the way a currently do it:

AWT MouseMotionListener
* read mouse position
* add x and y distance from center to internal dx, dy
* recenter mouse via Robot (if moved)

Input Thread (10ms sleep, high priority)
* read and reset dx and dy
* apply dx and dy to camera rotation

It runs a bit smoother if I change the MouseMotionListener a bit:
* read mouse position
* add x and y distance from last mouse position to internal dx, dy
* if mouse position is outside a defined region recenter it in that region via Robot

If I imagine this movement in some EGO-Shooter it would be unplayable :(

I've read about input handling abilities of LWJGL (maybe it will work better) but I don't want to switch just because of input issues cause I realy like the design of JOGL.

It would be nice if someone can help me to solve this problem.