Page 1 of 1

JavaFX Axes swapped

Posted: Thu Nov 19, 2015 9:33 pm
by haotenks
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:


Thanks!!!!!!! :D

Re: JavaFX Axes swapped

Posted: Fri Nov 20, 2015 8:45 am
by xranby
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.

Re: JavaFX Axes swapped

Posted: Sat Nov 21, 2015 8:53 am
by clicky
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.

Re: JavaFX Axes swapped

Posted: Mon Jan 25, 2016 8:29 pm
by TheLexus
@clicky Can you give me some hints how you do the calibration in your App?


Re: JavaFX Axes swapped

Posted: Tue Jan 26, 2016 4:40 pm
by clicky
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.

Re: JavaFX Axes swapped

Posted: Wed Jan 27, 2016 10:51 am
by ltorok