User avatar
schoolpost
Posts: 246
Joined: Sun Feb 19, 2017 10:47 am
Location: Canada

SDL2 Application Rotate Window 90

Wed Nov 29, 2023 8:24 pm

This will be an extension to an existing github issue I found here: https://github.com/ocornut/imgui/issues/3972
What is posted by the user is far from a working solution, because although It does render the view correctly, much of the UI and cursor still has issues.

I have 5.5" Waveshare display, it reports as a 1080x1920 display, which is unfortunate for me as my application requires a landscape orientation. I'm using a Pi5 with latest bookworm ( lite install no desktop ) and my application is Imgui based with SDL2/OpenGL3 backend. Until this point the KMSDRM driver has worked without a hitch, really enjoyed not requiring the overhead of X11.

But now, with this need to rotate the whole window/screen 90 degrees, I'm seeking what options I have to achieve this without fallbacking to using X11.

I've altered my /boot/cmdline.txt to include this:

Code: Select all

video=HDMI-A-1:1080x1920M@60,panel_orientation=right_side_up
which does show the console in the correct orientation, but when I launch the application it still defaults to portrait orientation.

What are my options here? I'm really trying to avoid using X11, maybe I'd try wayland but what steps are involved for doing this?
-Csaba Nagy

User avatar
schoolpost
Posts: 246
Joined: Sun Feb 19, 2017 10:47 am
Location: Canada

Re: SDL2 Application Rotate Window 90

Fri Dec 08, 2023 5:30 am

Excuse my lack of knowledge on the subject ( the reason I am here )

I've now tested using weston and also wayfire, but I'm a little less than knowledgeable on how to use them or how they may/may not interact with each other.

With weston, I can launch it via "weston-launch' using a keyboard connected directly to my Pi5, I'm presented with minimal desktop environment, I can from there launch my app from the terminal of the desktop environment. ( I have not been able to get display rotation working with weston... )

With wayfire, I can launch it via "wayfire" using a keyboard connected directly to my Pi5, I get a gray background and a mouse cursor. By editing the wayfire.ini I can set the display to rotate 90; which I can verify by the subsequent rotation of the mouse cursor. I don't see how I can launch any application unlike weston, it's just a blank screen.

I can't launch either 'weston' or 'wayfire' from SSH, which is unfortunate as this is how I drive my development 90% of time...

I'd like to have either 'weston' or 'wayfire' start from boot and also have my SDL2 app launch at startup. How does one configure the system to do this?
-Csaba Nagy

Return to “Graphics programming”