Skip to content
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] Off-by-one difference between DrawRectangleLinesEx and DrawLine/DrawLineV at drawing position. #3931

Closed
raulbonifacio opened this issue Apr 23, 2024 · 3 comments

Comments

@raulbonifacio
Copy link

Issue description

Hi! I've been testing raylib for some time and noticed a off-by-one difference between DrawRectangleLinesEx and DrawLine when drawing at the same position, creating a 2px border when combined. I looked into the documentation but couldn't find any mention of difference in behavior between those two. I've also tested with DrawLineV and the behavior persists.

Is this the expected behavior?

Thank you for you time!

Environment

Operating System: Endeavour OS
OpenGL: OpenGL version string: 4.6 (Compatibility Profile)
GPU: AMD Radeon RX 580 8GB

Issue Screenshot

weird

Code Example

#include <raylib.h>

int main(void) {

    InitWindow(400, 400, "Weird.");

    SetTargetFPS(75);

    Font font = GetFontDefault();

    Rectangle rect = {20, 20, 240, 240};

    while (!WindowShouldClose()) {

        BeginDrawing();

        ClearBackground(LIGHTGRAY);

        DrawRectangleLinesEx(rect, 1, DARKGRAY);

        DrawLine(rect.x, rect.y, rect.x, rect.y + rect.height, DARKGRAY);

        EndDrawing();
    }


    CloseWindow();

    return 0;
}
@raysan5
Copy link
Owner

raysan5 commented Apr 23, 2024

@raulbonifacio Are you testing latest raylib master branch? DrawRectangleLines() and DrawRectangleLinesEx() were reviewed 2 days ago... In any case, this could be not trivial to solve because I'm afraid that pixel offset could be GPU/driver dependant...

@raulbonifacio
Copy link
Author

raulbonifacio commented Apr 23, 2024

Hi @raysan5!

Yes, I'm testing on the master branch! Today I took my time to perform more tests. Just to be sure I pulled and compiled it again but nothing changed.

I tested on different hardware, without a dedicated GPU, but the issue persisted. It's a notebook.

Operating System: Endeavour OS
OpenGL: OpenGL version string: 4.6 (Compatibility Profile)
GPU: Intel Corporation TigerLake-LP GT2 [Iris Xe Graphics]

It's the same OS. Perhaps it has to do with the driver, as you've said.

WhatsApp Image 2024-04-23 at 10 45 44

@raysan5
Copy link
Owner

raysan5 commented Apr 28, 2024

@raulbonifacio Reviewed! Let's hope it works as expected in all GPU/drivers out there...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants