haotenks
Posts: 3
Joined: Mon Jan 27, 2014 5:46 pm

JavaFX Axes swapped

Thu Nov 19, 2015 9:33 pm

Hello everybody!! i am currently in a project with that technology (raspi and JFX) and i am using a touch screen connected by HDMI and USB for the touch, i calibrated the screen with "xinput-calibrator" and it found!! the touch is perfect.. BUT.. when i run my JFX application the calibration dissapears!! and i dont know why is this happening... :? :?

Could someone help me with this issue please??

i am using raspbian and this display:

Image

Thanks!!!!!!! :D

User avatar
xranby
Posts: 539
Joined: Sat Mar 03, 2012 10:02 pm
Contact: Website

Re: JavaFX Axes swapped

Fri Nov 20, 2015 8:45 am

There is no easy fix for you,
JavaFX reads the input directly from the linux /dev/input device driver files.
touch -> linux kernel -> /dev/input -> JavaFX recieve uncalibrated input

calibrating the screen using the xorg calibration tool do not change how JavaFX recive input. Only applications using xorg receive the calibrated touches
touch -> linux kernel -> /dev/input -> xorg (adds calibration) -> xorg application receive calibrated input

Thus the only way to make JavaFX on the Pi receive calibrated input is if you can change javafx to actually recieve its input from xorg!
touch -> linux kernel -> /dev/input -> xorg (adds calibration) -> xorg -> JavaFX recieve calibrated input

It is possible to create your own version of OpenJFX that can use xorg for input instead of reading /dev/input files directly. This is a project that takes about a month of work to implement if you dig into it and are familiar with both java and c system programming.
Xerxes Rånby @xranby I once had two, then I gave one away. Now both are in use every day!
twitter.com/xranby

User avatar
clicky
Posts: 405
Joined: Thu Oct 25, 2012 7:34 am

Re: JavaFX Axes swapped

Sat Nov 21, 2015 8:53 am

Of, if you are like me, make calibration inside of your app and use uncalibrated input and do translation yourself. If you are making project for yourself and as one of stuff, you can even hardcode calibration values.

TheLexus
Posts: 4
Joined: Fri Jan 22, 2016 7:11 pm

Re: JavaFX Axes swapped

Mon Jan 25, 2016 8:29 pm

@clicky Can you give me some hints how you do the calibration in your App?

Thanks!

User avatar
clicky
Posts: 405
Joined: Thu Oct 25, 2012 7:34 am

Re: JavaFX Axes swapped

Tue Jan 26, 2016 4:40 pm

Huh. It, kind of, doesn't work properly. Here's what I've done:

screenX = screenX * 1280 / 960;
if (screenX >= 1280) {
screenX = 1279;
}
screenY = screenY * 800 / 750;
if (screenY >= 800) {
screenY = 799;
}

(my screen size is 1280x800)

This is not good code and values of 960 for x and 750 for y coordinates I read and recorded. 960 is probably slightly smaller than actual where I managed 978 or so. I suspect they are 1024x768.

Also, those values are not absolute. Each time I start app something (probably in Java layer(*)) needs to find limits and auto-calibrate. It pushes min/max values as it reads them and only when I moved pointer to the borders it works well.
(*) I still didn't find time to investigate it properly. BTW I am using JOGL impl. with LibGDX.


Return to “Java”