Search code examples
libgdx

Incorrect touch location on 4k screen


I've been having some problems with touch detection on my current project, the problem is the higher the touch is on either axis the further off the touch point the touch registers.

In the image below you can see the issue i am talking about. The dot starts by rendering to the left of the mouse but by the time the mouse reaches the right side of the screen the dot is to the right of the mouse. The issue is much more obvious on the y axis.

enter image description here

The code running to create the above test is just the LibGDX SimpleTouchTest from https://github.com/libgdx/libgdx/wiki/Mouse%2C-touch-%26-keyboard so it is the absolute bare minimum.

The weird thing is, this only appears to be an issue on my laptop, on my desktop the dot sits under the mouse at all times. Both computers are running windows 10 so the only difference I can see is my laptop has a 4k display.

Has anyone found a solution to this issue?

Thanks Adrian


Solution

  • So for some reason this is now working. Nothing has changed in the code so I can only assume something was out of wack within windows or the graphics driver that has some how sorted itself out over the last few weeks. Thanks to those that took the time to read my question.