High precision mouse input


#1

I’m experimenting and trying out the different GLFW features and am currently wondering if there is sub pixel precision on windows platforms.
I found this that says it’s possible.
I tried the different cursor modes but always get per pixel values.
Is it just not supported on windows, or am i doing something wrong?

EDIT: If it’s relevant: I have a Logitech G502 mouse, which i used to test the mouse callbacks.


#2

Raw mouse input has been added for the case when the cursor is disabled, and it’s available in the in-progress code from Github but not yet in an official release.


#3

I this on the master branch? Because i am using the master branch, but don’t seem to get the desired behavior.
I pulled the most recent changes from master and recompiled just to be sure, but there was no change.

EDIT: I tried all different cursor modes with the same result of per pixel movement. Is this input mode only dependant on the set cursor mode (cursor disabled)?


#4

WM_INPUT is only used when GLFW_CURSOR_DISABLED is set, see the glfw Windows message handler in win32_window.c on master branch.


#5

That MSDN page does imply that it provides sub-pixel motion, but as far as I’ve been able to tell it doesn’t.

What it does provide and what GLFW now supports in master is unfiltered motion, i.e. no acceleration or other effects have been applied to it, making it more suitable for camera controls.


#6

Yes, im using GLFW_CURSOR_DISABLED as i mentioned earlier.

@elmindreda Interesting. Just another question: The glfw functions as i understand always return a cursor position. Is there an alternative that supplies deltas, or do i have to do that myself (would’nt be a problem, but if there already is functionality for this, why not use it).


#7

You need to calculate the delta yourself.


#8

Thank you for the answers!


#9

Experimentation on my system with my mouse settings, with GLFW_CURSOR_DISABLED a vertical motion of ~25mm gives me a delta of 1000 whereas I need a vertical motion of 50mm to get the same delta without GLFW_CURSOR_DISABLED. So for my settings I get ~2x the precision from WM_INPUT.

The mouse I used for the test has 1000dpi resolution, which is consistent with the 1000 delta for 25mm as an inch ~25mm.


#10

I see absolutely no difference with my 1200 dpi mouse. With cursor disabled i get the same as when it is enabled with various settings of dpi (tested with 400 dpi, 800 dpi and 1200 dpi)
My mouse settings are as follows: The pointer speed in windows is set to neutral (the middle bar) and i have acceleration off.
So basically i guess all the raw input does is take away the mouse accel and the pointer speed set in the settings.


#11

Using raw input can only give you as much precision as your hardware. If
you measure distance to deltas with your different mice do you see the same
results as their dpi resolution when using raw input?