I think that the first answer here is pretty much spot-on:
https://stackoverflow.com/questions/191 ... rough-glfw
I've used a 4X speed (240 FPS) camera to track the exact frames in which events occur, and the delay is between 1 and 2 frames, and it's pretty often in between.
This sequence shows the first frames where the moved cursor/box becomes visible, omitting the rest:
- FrameDelay.gif (407.69 KiB) Viewed 3900 times
Note how in some intermediate frames, the square is clearly
halfway at some place between where the two cursors were. That tells us that the lag is somewhere between 1 and 2 frames.
So I've made an experiment: let's measure the mouse position near the end of the frame, instead of at the beginning.
Code: Select all
local present = love.graphics.present
function love.graphics.present() end
function love.draw()
local x, y = love.mouse.getPosition()
love.graphics.rectangle("fill", x-5, y-5, 10, 10)
present() -- waits for vsync
-- Sleep for most of the frame time before the next round of
-- event polling
love.timer.sleep(1/64)
end
And indeed, the response was quicker.