-
Notifications
You must be signed in to change notification settings - Fork 26
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
Incorrect position/scale on Mac OS #27
Comments
My initial guess here is that this is something related to DPI and that likely the mouse coordinates might not match up with window coordinates. I don't have a macos machine that I can test with, you could try looking at the mouse position sent to ImGui and compare it to the window size that is sent to ImGui and there will likely be some discrepancy. |
That sounds pretty weird too, my guess is that some event that is called when the window moves is doing something weird. Can you check what events get triggered when you move the window? |
So I managed to make ImGui use the whole window, not 1/4 part of it. But there's still an issue with window content disappearing when I move it out of the left up corner CleanShot.2022-12-25.at.19.29.45.mp4 |
That looks like an issue with scissor testing... something where the scissor area gets put too far out |
It is happening the same to me, any update on this issue? Thanks! |
In my case, I just fixed it by modifying the scalefactor, line Previous
After
|
This seems to me like a DPS/Retina thing as the factor is 2. Maybe it's possible to get the scale factor from GLFW directly? |
@NogginBops, indeed. I just modified:
@ imGuiController.cs .
.
.
/// <summary>
/// Constructs a new ImGuiController.
/// </summary>
public ImGuiController(int width, int height, float scaleFactorX=1, float scaleFactorY=1 )
{
_windowWidth = width;
_windowHeight = height;
_scaleFactor.X *= scaleFactorX;
_scaleFactor.Y *= scaleFactorY;
.
.
.
}
.
.
. @ Window.cs .
.
.
public class Window : GameWindow
{
ImGuiController _controller;
public Window() : base(GameWindowSettings.Default,
new NativeWindowSettings() {
Size = new Vector2i(1600, 900),
Flags = ContextFlags.ForwardCompatible
})
{ }
protected override void OnLoad()
{
base.OnLoad();
Title += ": OpenGL Version: " + GL.GetString(StringName.Version);
// Initialise the Scale Factor
float scaleFactorX = 0;
float scaleFactorY = 0;
// Get the Scale Factor of the Monitor
this.TryGetCurrentMonitorScale(out scaleFactorX, out scaleFactorY);
// Instanciate the ImGuiController with the right Scale Factor
_controller = new ImGuiController(ClientSize.X, ClientSize.Y, out_width, out_height);
}
.
.
.
} |
Patch is working fine on MacOS. I have adjusted ImGUIController in order to have a sample working on MacOS/Win10/Linux : https://github.com/DigitalBox98/Dear-ImGui-OpenTK-Sample |
if I try to run your code on Windows, everything works, but on Mac OS there's something wrong with position or scale (or both of them). As you can see on the screenshot, I moved cursor out of the window and only after this one of the ImGui buttons became blue.
Also if I try to move the ImGui demo window, it starts to disappear if it gets out of the left bottom 1/4 part of the window
The text was updated successfully, but these errors were encountered: