Hiding mouse cursor with glfw

JMCampos picture JMCampos · Dec 13, 2010 · Viewed 16.4k times · Source

I'm working with a game made with glfW and running in Ubuntu. My problem is that hiding the mouse cursor with the line

glfwDisable(GLFW_MOUSE_CURSOR);

causes some machines to simply disregard the mouse input, and thus breaks the game.

Has anyone faced this problem? If so, what was your workaround?

Answer

Alexandre Jacob picture Alexandre Jacob · May 15, 2014

Since glfw 3.0 the API call has changed, you must use glfwSetInputMode with a pointer of your window.

glfwSetInputMode(window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN);

For more information see http://www.glfw.org/docs/3.0/moving.html