-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
[rshapes] DrawRectangleRoundedLines()
results not aligned with DrawRectangleRounded()
#4601
Comments
DrawRectangleRoundedLines()
results not aligned with DrawRectangleRounded()
I think the issue is related to an off-by-one-pixel on lines calculations and I'm afraid that's a GPU-driver dependant issue, very difficult to address. Related to this, we have |
Wow, never expected a driver to break such a simple thing |
Updating to 24.12.1 driver didn't fix the issue :( |
@raysan5 I get exactly the same result, seemingly pixel-perfect, on: INFO: > Vendor: NVIDIA Corporation
INFO: > Renderer: NVIDIA GeForce GTX 980/PCIe/SSE2
INFO: > Version: 3.3.0 NVIDIA 550.120
INFO: > GLSL: 3.30 NVIDIA via Cg compiler I tried enlarging and highlighting the offset with transparency if that helps: However, if I use Edit: I haven't dug deeply to check if raylib applies this kind of correction, but the observed offset might come from this? |
@Bigfoot71 There could be multiple elements involved in the pixel offsets and the rounded corners, from GPU to driver (specially on integrated GPUs). But definitely requires some review. About The 0.5 offset has been also tried several times and it's also platform dependant... |
@raysan5 Argh, I just did a test with the response right above using the 0.5 offset, but if it doesn't work everywhere, it's probably because different hardware/drivers have different rounding conventions. In that case, it's a lost cause. We can do our best for the most common convention, but listing the conventions for each hardware/driver to adapt the method seems like a futile effort... |
@Bigfoot71 Looks nice, does it work on NVIDIA and AMD? Feel free to send a PR and I'll try on my laptop with NVIDIA and Intel integrated graphics. |
@raysan5 I just created a PR, draft for now, as I would like to get your feedback on Otherwise, I was able to test this on an old laptop with an NVIDIA Quadro NVS 160M (no issues), that's all I can do from home. It would be great if @Kaehvaman could try replacing the points I shared above in |
@Bigfoot71 I compiled your fork and it looks ok, except for some overlapping pixels (i used colors with 150 alpha). |
Issue description
DrawRectangleRoundedLines draws weird unequal corners and is taller and wider than DrawRectangleRounded, which draws identical corners.
DrawRectangleRoundedLinesEx with lineThick != 1 works as expected, so the issue is linked to lineThick of 1 pixel.
Environment
Windows 10
Visual Studio 2022
MSVC
C language
raylib.lib from v5.5 release
INFO: GL: OpenGL device information:
INFO: > Renderer: AMD Radeon RX 6750 XT
INFO: > Version: 3.3.0 Core Profile Context 24.10.1.241007
INFO: > GLSL: 4.60
Issue Screenshot
Code Example
Rectangle roundRect = { 100, 250, 185, 36 };
DrawRectangleRounded(roundRect, 0.5f, 6, BLACK);
DrawRectangleRoundedLines(roundRect, 0.5f, 6, ORANGE);
The text was updated successfully, but these errors were encountered: