How can I detect mouse passive motion with opengl ? In other words, how can I understand whether it is moving forward, backward, left, right ?
I have done
glutPassiveMotionFunc ( func )
void func ( int x, int y ) {
// x and y always positive, I wait it should be negative if it goes left
// acc. to my coordinate system determined in glLookAt.
}
From the docs:
If you’re interested in how the cursor moved between two frames (a delta), store the cursor position every frame and calculate the difference between the “current” position and the “last seen” position.