Reputation: 1613
When i make my program to use only 0-2% cpu (removed some CPU intensive opengl function), my mouse coordinates starts to lag! and when i use 100% CPU (when enabling the opengl function) i get nice and smooth mouse coordinates, note that the opengl function does nothing to my mouse coordinates. look at below image i recorded my rotation function values by using mouse coordinates:
This is with 100% cpu usage (as it should look): no lag http://img15.imageshack.us/img15/1304/mousecursorsmoothcoords.png
-
This is with 2% cpu usage: lag http://img5.imageshack.us/img5/5514/mousecursorlaggedcoords.png
It is really annoying problem, because i am using mouse cursor position to change the rotation angle, and with the above image case, it looks really laggy rotation.
I might be able to make own interpolation or something, but i want to know what is causing this and how to fix it.
Im getting mouse coordinates with WM_MOUSEMOVE message and i also tried to use GetCursorPos() on every frame before my rotation code, but it has no difference.
Edit: I noticed that the CPU usage doesnt have to be 100% to get smooth, but the CPU just needs to be "waken up" and then it stays smooth even with low CPU usage.
Upvotes: 1
Views: 996
Reputation: 340486
You might be able to get better information about the mouse motion by using the GetMouseMovePointsEx()
API.
Sidenote: for some reason I can only see your first graphic
Upvotes: 0
Reputation: 59151
Your second graph seems like it is "bunching" updates. Jumps on the Y axis seem to be at a fixed frequency on the X axis.
Speculation:
Upvotes: 1