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] Horizontal and Vertical Lines Starting at {0, 0} Not Drawing in Raylib #4130

Closed
4 tasks done
evanz2608 opened this issue Jul 6, 2024 · 5 comments
Closed
4 tasks done

Comments

@evanz2608
Copy link

Please, before submitting a new issue verify and check:

  • I tested it on latest raylib version from master branch
  • I checked there is no similar issue already reported
  • I checked the documentation on the wiki
  • My code has no errors or misuse of raylib

Issue description

Hi, while trying to draw horizontal lines i found that the line starting at {0, 0} does not get drawn. Same issue if i tried to draw vertical line.

Environment

Platform: DESKTOP
OS: Arch linux
INFO: GL: OpenGL device information:
INFO: > Vendor: AMD
INFO: > Renderer: AMD Radeon RX 570 Series (radeonsi, polaris10, LLVM 17.0.6, DRM 3.57, 6.9.5-arch1-1)
INFO: > Version: 4.6 (Core Profile) Mesa 24.1.1-arch1.1
INFO: > GLSL: 4.60

Issue Screenshot

screenshot_20240706_021854

Code Example

#include <raylib.h>

int main() {
  int width = 800;
  int height = 600;
  int row_size = height / 10;

  InitWindow(width, height, "Title");

  while (!WindowShouldClose()) {
    BeginDrawing();

    ClearBackground(DARKBLUE);

    for (int y = 0; y <= row_size; ++y) {
      DrawLine(0, y * row_size, width, y * row_size, WHITE);
    }

    EndDrawing();
  }
  CloseWindow();
}
@raysan5
Copy link
Owner

raysan5 commented Jul 7, 2024

@evanz2608 I verified this issue, it is highly dependant on GPU and drivers. The logic to draw the line it's following the expected OpenGL specs but drivers decided it's out of screen and should be culled, already reviewed that function several times but every new update breaks something else.

I'll try to revert to previous implementation, using QUADS instead of LINES, that seemed to work for most cases, except this #3884

Related issues:

@evanz2608
Copy link
Author

@raysan5 Ohh i see, thx for the response! Closing the issue then.

@raysan5 raysan5 reopened this Jul 7, 2024
@raysan5
Copy link
Owner

raysan5 commented Jul 7, 2024

@evanz2608 Reopening it! Actually the issue has not been addressed yet! Indeed drawing a line at 0,0 must work! 😄

@evanz2608
Copy link
Author

First of all, sorry for my bad english, i will try to explain myself the best i can.
I think i found what the problem is. Because i tried to use 0 as Y coordinate in both start and end point of the line, the gpu never draw the line because it never passes through the center of any pixel. If i pass startPosY=1 and endPosY=1, then the line are drawn into the first pixel row of the window. Use DrawPixelV instead and adding 0.5 to each component of the vector solves the problem.

@raysan5
Copy link
Owner

raysan5 commented Aug 24, 2024

Issue addressed by proposed PR, discussion can continue there...

@raysan5 raysan5 closed this as completed Aug 24, 2024
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