Hi everyone
GLFW Version: 3.2.1 X11 GLX EGL clock_gettime /dev/js Xf86vm shared
I’m trying to implement FPS camera using glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
feature of GLFW. However, whatever the direction I’m moving the mouse, the position recieved in the callback glfwSetCursorPosCallback(window, mouse_pos_callback);
is always decreasing.
Test code
static void error_callback(int error, const char *description)
{
fprintf(stderr, "Error: %s\n", description);
}
static void mouse_pos_callback(GLFWwindow *window, double x, double y)
{
fprintf(stderr, "Pos: %f, %f\n", x, y);
}
int main(void)
{
GLFWwindow *window;
glfwSetErrorCallback(error_callback);
if (!glfwInit())
exit(EXIT_FAILURE);
window = glfwCreateWindow(640, 480, "Simple example", NULL, NULL);
if (!window)
{
glfwTerminate();
exit(EXIT_FAILURE);
}
glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_DISABLED);
glfwSetCursorPosCallback(window, mouse_pos_callback);
glfwMakeContextCurrent(window);
glfwSwapInterval(1);
while (!glfwWindowShouldClose(window))
{
glfwSwapBuffers(window);
glfwPollEvents();
}
glfwDestroyWindow(window);
glfwTerminate();
exit(EXIT_SUCCESS);
}
Output
joris@joris-MS-7998:~/projects/graphics/build/linux$ ./demo
Pos: -555.000000, -333.000000
Pos: -875.000000, -573.000000
Pos: -1195.000000, -813.000000
Pos: -1515.000000, -1053.000000
Pos: -1835.000000, -1293.000000
Pos: -2155.000000, -1533.000000
Pos: -2475.000000, -1773.000000
....
// moving mouse up/down/left/right/kicking_it_on_the_table
// the value is always getting lower and lower and lower :smile:
Using glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_NORMAL);
is however working properly.
Software/Hardware
I'm using XUbuntu 17.04 and my mouse is "ROCCAT ROCCAT Kone XTD" as shown with xinput command line. Am I doing something wrong or is this a bug ?What I've tested
TEST1: I just tested on my laptop, running the same Ubuntu version, but using the trackpad and everything is working properly.
TEST2: I plugged the mouse on the laptop. Everything working proplery.
TEST3: Plugged back the mouse on the desktop... and it's working properly as well, like what the hell. So something is my configuration is fucked up xD.
The actual problem
I figured it out. Actually, when the os start, I run the following script to reduce the mouse sensivity:xinput --set-prop 12 "libinput Accel Speed" -0.25
// This line seems to be causing the issue, but I don't understand why since
// it's a simple scale matrix without any negative sign in it
xinput --set-prop 12 "Coordinate Transformation Matrix" 0.6 0 0 0 0.6 0 0 0 2
Can I have a direction in GLFW sources so I can understand why is this causing trouble ?
Best regards.