LWJGL 3 / GLFW: Raw relative mouse motion input

Started by Kai, January 12, 2015, 09:22:27

Previous topic - Next topic

Kai

Hey everyone,

I have proposed under https://github.com/glfw/glfw/issues/125 a solution for raw relative mouse motion in GLFW under Windows, because I needed/wanted that feature so badly. :)
It so far had good response within the GLFW community, so I am hoping that it will make its way into GLFW 3.2 and therefore soon into LWJGL 3.

However, for everyone wanting to play with it right now, I already have a running GLFW and LWJGL 3 Windows implementation ready.

You can checkout the forked LWJGL 3 sources with that feature included via Git: https://github.com/httpdigest/lwjgl3.git

And you can build it yourself via the Microsoft Windows Platform SDK or an installation of Visual Studio Express/Community Edition.
Currently, a pre-built glfw3.lib is included in the LWJGL3 Git repository only for x64.
Normally, it would be automatically downloaded by the LWJGL 3 Ant buildscript from the Amazon Cloud, but since I had no access to that, I included it directly in the Git repository.
If you want to build the glfw3.lib for x86, you can checkout:

https://github.com/httpdigest/glfw.git

And run CMake within the Windows Platform SDK (or Visual Studio) Tools command prompt on it, and then run "MSBuild GLFW.sln".

For those of you who cannot or do not want to build it on their own, the LWJGL3 fork repository also includes a prebuilt lwjgl.dll for x64 under /prebuilt/windows/x64 as well as the lwjgl.jar under /prebuilt.

What do you get?

- a new callback type GLFWRawMouseMotionCallback with callback register method "glfwSetRawMouseMotionCallback" and a windows creation flag GLFW_MOUSE_USE_RAW_INPUT (via glfwWindowHint) to enable it with (= GL_TRUE)
- that callback delivers raw relative mouse input directly from the mouse driver
- it is not subject to cursor acceleration (or ballistics as it is called under Windows)
- it is not subject to cursor position or the cursor being stuck at the edge of the screen

Many applications need such relative mouse input (like the mouse controls in a first-person camera). Without it, you would need to rely on mechanisms to artificially reset the cursor position to the center of the screen and workarounds for unwanted mouse events.
With this solution you get direct relative mouse motion input.

Please try it out and maybe add a comment on the GLFW issue to vote for it being included into GLFW.

Thank you!

Regards,
Kai

Kai

Prebuilt Windows x86 lwjgl.dll is now also up under /prebuilt/windows/x86.

EDIT:

Stupid MSVC x86 stdcall name decoration (underscore plus @ plus number of bytes of arguments) currently prevents exported function names to be found by the JVM.
Cannot be that there is no switch to turn that off except for providing a manual export .def file.... These are the times when I hate MSVC...
Will use mingw for the x86 build.