lwjgl mousepointer delay

Hi, just tried out the first example og lwjgl using the example script (example in the “how to intall in netbeans”, the one with the moving square)
http://www.lwjgl.org/wiki/index.php?title=Setting_Up_LWJGL_with_NetBeans

Anyhow, in this example I notice a delay of like 2 frames between moving the mouse, catching the mouseposition
and updating the square. (example is running on 60FPS)
Is there a faster or more direct method to catch the mouseposition?
Increasing the FPS does not seem to speed that up.


public void processMouse()
	{
		squareX = Mouse.getX();
		squareY = Mouse.getY();
	}

According to the LWJGL source code, that is the most direct possible since they poll the native C API every call to Display.update().

Ok, so there is a general delay in upating the keyboard.

Your problem is that the latency for reading mouse input is 1 frame (necessarily); then you go on to update some game object and render it, but that takes another frame before it is actually rendered. Or possibly even two frames, if you’ve got a triple-buffered display. There’s nothing you can do about this except live with it. This was the primary reason people used to turn off vsync in FPS competition games even though it made the graphics horribly torn.

Cas :slight_smile:

Ok, makes sense. The doublebuffering would force a slowdown anyhow.