Hey
So I ran into a problem with polling input in LWJGL3, I want to have the mouse speed at each frame, so for that I use the following code in my update method:
DoubleBuffer xpos = BufferUtils.createDoubleBuffer(1);
DoubleBuffer ypos = BufferUtils.createDoubleBuffer(1);
GLFW.glfwGetCursorPos(window, xpos, ypos);
xpos.rewind();
ypos.rewind();
float dx = 640 - xpos.get();
float dy = 400 - ypos.get();
GLFW.glfwSetCursorPos(window, 640, 400);
The 640 and 400 come from my window dimensions (1280x800) to keep the mouse centered. Now the problem is the GLFW.glfwSetCursorPos does not seem to work as I can move my mouse freely with the whole scene rotating like crazy.
I am working with multithreading since I have 2 windows. With just having one window the code works just fine, but since the method gets the window as a parameter it shouldn’t be a problem to lock the cursor to that window no?
Additional Information:
-I did not create a cursor object from GLFW but it should work without that
Edit:
GLFW.glfwSetInputMode(display.window, GLFW.GLFW_CURSOR, GLFW.GLFW_CURSOR_HIDDEN);
does not work either