-
-
Notifications
You must be signed in to change notification settings - Fork 10.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rotating display is fine, but clipping is an issue (SDL2+OpenGL ES - No X server) #3972
Comments
You will need to rotate the projection matrix in the renderer. This will need modifying the renderer. You may need to rotate the mouse position as well. |
Great success... I modified the
I had to comment out because of some weird clipping issues.
And in SDL2_NewFrame(), I hardcoded my screen dimensions...
and swapped X & Y in the mouse input :) |
As @ocornut explained, I needed to rotate the projection matrix so modified
I then have display in correct orientation working nicely, except.... I had to comment out Now I need to get glScissor working with the rotated projection matrix because the mess is terrible. I am not very smart when it comes to OpenGL and projection matrices etc... I have tried a few permutations, I thought swapping x and y would be sufficient, but I am doing something very wrong and not really understanding. Should I be changing the clip_rect, or the order of the input arguments to glScissor ? In normal orientation, I think clip_rect.x and .y are top-left x,y of a rectangle, .z and .w are bottom-right x,y so why is swapping them not rotating the rectangle properly? [original from impl_opengl3.cpp]
|
I have tried several permutations of swapping and offsetting |
Did you get a work around for this? I have a waveshare display that is 1080x1920, but I need my fullscreen Imgui app to display as 1920x1080 I need everything rotated 90 degrees, I'm trying to avoid the overhead of X11 or Wayland with my Raspberry Pi 5 / Debian Bookworm setup. |
I have found a solution for the clipping when rotating the screen 180 degrees. This is the correct way: // Apply scissor/clipping rectangle (Y is inverted in OpenGL)
GL_CALL(glScissor((int)clip_max.x, (int)((float)fb_height - clip_min.y), (int)(clip_min.x - clip_max.x), (int)(clip_min.y - clip_max.y))); So basically you just replace min with max and vice versa. For 90 degrees I think you also have to swap and/or negate x/y. But this will hopefully make finding the right permutation easier. |
Version/Branch of Dear ImGui:
Version: 1.82
Branch: master
Back-end/Renderer/Compiler/OS
Back-ends: imgui_impl_SDL.cpp + Open GL ES on Raspberry Pi4 (SDL2 kmsdrm driver, without X11)
Compiler: gcc
Operating System: Linux / Raspbian
My Issue/Question:
Is there a way to have Dear ImGui globally swap X and Y coordinates, that is, to draw the whole UI in a rotated orientation?
I have a "1920x480 LCD Panel" letterbox HDMI display, however it is really a 480x1920 LCD Panel, and I cannot find driver support or a method of using SDL to rotate the display for me. I am not using X11.
I believe swapping X and Y would do the trick, is this achievable?
The text was updated successfully, but these errors were encountered: