Running a processing java app on a raspberry pi changes everything over the Y axis


I am putting some text inside of a box by using the text() function and passing in the coordinates of the center of the box. I am also centering the text with textAlign(CENTER, CENTER) On windows, this produces the following result:

If I run the built artifact (I use intellij) on a raspberry pi with the java -jar command, it produces this result: (please don’t look at the upside down, that is not the point :slight_smile: )

This happens when using the Prometo font, a font I import during setup. I am also using the textMode(SHAPE) command and the P2D renderer with the raspbian opengl fake KMS drivers enabled. Changing to non P2D and turning off shape mode does not solve the problem.

Any ideas as to how I can fix this?

Probably something to with processing coordinate system. As a work around you could probably use scale(1, -1, 1) might need to push/pop matrix.

Would scale(1, -1) suffice for P2D? Im only doing 2D stuff.

I think so but you might need translate as well (or otherwise calculate correct coordinates).

Scaling with scale(1, -1) and then translate(0, height) only makes the entire picture 180 degrees upside down, it does not affect the vertical alignment of the text in the rectangles.

The geomerative library (doesn’t seem to be supported anymore), but its brilliant at manipulating text, you could try that. See it in action here.

I just tried with a different screen and the problem no longer happens. Very interesting :slight_smile:

I was also noticing that my circles were slightly ‘squeezed’, they were shorter in Y than in X, this also does not happen with a different screen. It seems something is wrong in the Y axis with some of my screens. The screen that is having the Y issue is a official raspberry pi touchscreen connected trough the DSI connector, connecting it trough HDMI has the same issue. Connecting the raspberry to a normal HDMI monitor, the issue is gone :open_mouth:

Would there be any way to debug why this happens so I can fix it? It needs to work with the other screen as well.

It seems it is possible to rotate screen orientation Raspberry Pi Documentation - Display

Yes, I know. But rotation is not my issue, the Y alignment is the issue.

Bump. Does anyone know why the Y seems squeezed on these displays?