Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Raspberry Pi / Display Rotation

Author
Message
Yeshu777
4
Years of Service
User Offline
Joined: 26th Feb 2020
Location: Cardiff ( Caerdydd ), Wales ( Cymru ), UK
Posted: 4th Feb 2024 02:23
Hi All,

Was thinking if it's worth working on adding a new command to the Core to rotate display ( ie, transpoe the co-ords etc / rotate the images etc ).

JD etc have a lot more experience with the Core mods so was asking how much work this would be, before I start.

Answers on a post-card.

Yeshu





JDforce
20
Years of Service
User Offline
Joined: 27th Jul 2004
Location: Sea of Tranquility
Posted: 4th Feb 2024 17:08
I won't mess with that, because it could really be a daunting task, unless you just rotate the 2d camera, which I could not find in the code. Maybe look for it.
I'd rather:
For 3d, nothing is needed, Just rotate the camera.
For 2d without physics it is probably better to just rotate your images and your movement logic.
In addition, for particles and 2d physics, swap x and y gravity coordinates.

Or maybe it is better to rotate your display to be vertical, and set your app borderless (instead of fullscreen) with lower virtual resolution. In that case it is better to look at an improved display driver (overlay in the pi) that better handles gpu vertically
Let's go to Mars
Virtual Nomad
Moderator
18
Years of Service
Recently Online
Joined: 14th Dec 2005
Location: SF Bay Area, USA
Posted: 4th Feb 2024 22:24 Edited at: 4th Feb 2024 22:24
unsure of the ultimate goal here (and, as mentioned, i've no Pi knowledge) but SetRenderToImage() may help where you could draw everything to a single image, hide all but the Render Image and rotate at will?

again, not sure of what you're trying to achieve but suggesting/reminding you of the command and its potential
Zappo
Valued Member
20
Years of Service
User Offline
Joined: 27th Oct 2004
Location: In the post
Posted: 5th Feb 2024 02:57
I'm not sure why you would want to do this. The Raspberry Pi operating system lets you set the rotation for the display so you don't need to in your apps. You can pick 0 or 180 degrees (landscape), or 90 or 270 degrees (portrait). I may be missing something but can't think of a reason why you would want to have the desktop at one orientation and your app run in another.
JDforce
20
Years of Service
User Offline
Joined: 27th Jul 2004
Location: Sea of Tranquility
Posted: 5th Feb 2024 21:06
Guys,
The reason is to use display rotation like that is to have the monitor oriented vertically, meaning rotate it 90 or 270 degrees, to run the application in a kiosk.

The first natural action you wan to make is to rotate the whole interface in the operating system. As you can check in other thread, the experiments demonstrated that this rotation of the operating system alone reduces the AppGameKit game framerate in a half for the raspberry pi 4 with buster, bullseye or bookworm. I didn't have any reduction on the Raspberry pi 3b+ with Jessie.

In the raspberry pi 4, making the application full screen reduced the framerate by another 50%. So, OS display rotated plus fullscreen made the FPS only 25% of the maximum FPS in landscape and not full screen.
In other words, the reason is not to lose FPS in such a dramatic percentage.

Yeshu777 is looking for alternatives to rotate everything in code, so it is just a matter of physically rotating the monitor but not the OS interface.

VirtualNomad, do you have a simple example of how to achieve this with RenderToImage() to render 2d sprites and animation? (Not the Snow flakes from the example projects) In theory it was the ideal thing to do (render to the image and then rotate camera) but I could not make the 2D world animation to an image, for sure am doing something wrong. In my test, 2D always render in the normal orientation, on top of 3D. Even if successful, we need to keep an acceptable Frame rate.




Let's go to Mars
Yeshu777
4
Years of Service
User Offline
Joined: 26th Feb 2020
Location: Cardiff ( Caerdydd ), Wales ( Cymru ), UK
Posted: 7th Feb 2024 01:01
Thanks JD,

Yes, there are FPS limitations when rotating via the OS ( display_rotate=3 ) - so just looking at an acceptable way to improve upon this.

Yeshu77

Login to post a reply

Server time is: 2024-11-17 23:37:32
Your offset time is: 2024-11-17 23:37:32