Mouse movement is limited in fullscreen

#1

Hello.

I’m using glfw in mingw. When i switch to fullscreen i can move my camera only about 90 degrees in any direction(left, right, up or down). When i’m trying to go over 90 degrees then mouse callback sends only zero values.

glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_DISABLED) doesn’t change this behavior. But with cursor enabled i can see that mouse movements are bound to cursor movements inside window.

AFAIK this behavior is same when mouse input is captured by specific window with a function like SetCapture. Is it possible to have different behavior where we can rotate a camera 360 degrees?

Thanks.

0 Likes

#2

Using GLFW_CURSOR_DISABLED works for me on the platforms I’ve used, so perhaps this is a MinGW related issue. Could you add some more information about which version of GLFW you are using and whether you compiled it yourself, if so how etc.?

0 Likes

#3

Hmm. I found the root cause.

glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_DISABLED); works.
It doesn’t work if after it we call glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_HIDDEN); I suppose I should call glfwSetInputMode(m_window, GLFW_CURSOR, GLFW_CURSOR_DISABLED | GLFW_CURSOR_HIDDEN); if i want to have two flags enabled.

Thanks!

0 Likes

#4

Excellent, glad you have a solution.

Note that the values are not flags, and cannot be or’d together. GLFW_CURSOR_DISABLED will hide the cursor so you don’t need GLFW_CURSOR_HIDDEN. You only need the later if you want to hide the cursor but keep the standard behaviour, for example to implement your own cursor rendering.

0 Likes