AddRect has non-square corners when antialias disabled on retina display

This may be retina display specific.

When using AddRect(), I do not get squared corners on rectangles. Instead, the vertical and horizontal lines intersect at the vertex and leave the corner pixel unfilled. You can see this behavior in the custom render demo by turning off the antialiasing (works as expected when antialias turned on). The squares in the demo will have unfilled corners.

I have easily gotten around with my own helper that just draws the four lines with the end points adjusted by half a pixel so the lines properly form square corners.

Is this expected, or is this an issue?

Which version of imgui, which renderer, etc. ?
There was a bug like that in old version of dear imgui… not in the latest afaik.

1.71 GLFW opengl3

I will upgrade to 1.72 and get back to you.

Upgraded to 1.72, and have same issue.

Again, if you just force the antialias flags off in the custom render example, you can see the issue. The attached image shows the zoomed rects.

Oh, you mean thick rectangle… not with the default thickness (that’s often use different code).

That’s indeed a bug, and the non-AA path has clearly been neglected.

You may open an issue on the github tracker (it won’t be tracked if it’s not there), or possibly attempt to provide a fix for it. It also would be interesting to know why you are using the non-AA path.

Actually, thickness of 1.0 also has issue on retina (because it is using 4 physical pixels per rendered pixel - top rect in image is thickness 1.0). I am still early in dev, and learning about high DPI, and need to try my code on different displays and renders. This all came about because I was trying different things to understand how imgui coordinates map to physical pixels.

My app is doing a lot of pixel perfect drawings (charting), so I jump in and out of AA as needed (main UI uses AA). I can create the rect using lines no problem, and can create my own helper etc., just needed to understand if this was an issue or not.

I will add to github once I work thru some more scenarios. Thanks.

Thank you. Any further feedback you have in order to improve rendering functions down the line is much appreciated.