-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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] DrawRectangleLines()
lines flickering when zooming out due to RL_LINES
vs RL_QUADS
#3884
Comments
DrawRectangleLines()
lines flickering when zooming out due to RL_LINES
vs RL_QUADS
@arceryz Good catch! And thanks for reporting! I expected OpenGL driver to manage that properly on its side... but effectively lines rendering is completely different than triangles... It probably can't be addressed from raylib side but just be properly documented. |
@raysan5 Would it be an option to have all the pure |
For consistency, now _almost_ all `Draw*Lines()` functions use `RL_LINES` mode for drawing. It solves the linked issue but it can have other implications, as mentioned in the WARNING comment in `DrawRectangleLines()`. Side note: `DrawRectangleRoundedLines()` now should be reviewed for consistency.
@arceryz Also note that |
Please, before submitting a new issue verify and check:
Issue description
When working with
DrawRectangleLines
, the behavior as expected is to have the rectangle drawn with RL_LINES, i.e pure OpenGL lines with no artefacts at small distances likeDrawLine
. However,DrawRectangleLines
(and possible other fake*Lines
drawing methods) are rendered with Quads whenSUPPORT_QUADS_DRAW_MODE
is true. While I understand that this may be for avoiding draw order issues (as stated in the source comment), intuitively one would expect that*Lines
methods are drawn with pure OpenGL lines to avoid artefacts.So I would recommend not mixing RL_LINES and Quads when possible and to be clear which or the other any function in
rshapes.c
is using.I encountered this when creating an infinite grid when zooming in and out on a tool, using
DrawRectangleLines
would have the rectangle flickering at high levels of zoom, because the quads become sub-pixel sized. It is not a big issue, because I can just implement a customDrawRectangleLines
that draws 4 lines instead (as expected). But I think it may be better to have all the*Lines
function (except theEx
versions withlineWidth
) to be rendered always with RL_LINES and not quads.It is in particular this piece of code in
rshapes.c
:See the gif for a demonstration of the issue and how it may work counterintuitively for Raylib users. (Expectation: rectangle remains a rectangle at big distance).
Environment
Windows, vanilla Raylib 5.0 C
Issue Screenshot
The left square is the expected behavior (4 lines) and the right square is
![Bug](https://private-user-images.githubusercontent.com/88434630/316665233-bee6f8e0-8a77-47d7-9d36-4187be51056a.gif?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MTk2MTQzMDksIm5iZiI6MTcxOTYxNDAwOSwicGF0aCI6Ii84ODQzNDYzMC8zMTY2NjUyMzMtYmVlNmY4ZTAtOGE3Ny00N2Q3LTlkMzYtNDE4N2JlNTEwNTZhLmdpZj9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA2MjglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwNjI4VDIyMzMyOVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPWJkMDZhNTllMjM3OTk4MmVmMzQxNzc5YmJmYjI5ZjAyOGRhOGJjNGY4YjAwOWFlM2EzYjVmODNiYTg0YjYwNzkmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.9wE8-FaAOPb7jdmQNUVfcsAo27Vk_WK2IHhzIkB1ndY)
DrawRectangleLines
.The camera is zoomed out progressively. With greater zoom levels,
DrawRectangleLines
becomes basically pointless.Code Example
It is python code because I wrote quickly, but it is nothing special and would look the same in C.
The text was updated successfully, but these errors were encountered: