| Summary: | SDL_RenderDrawLine(s) not drawing 1 pixel line | ||
|---|---|---|---|
| Product: | SDL | Reporter: | Marcel Bakker <mna.bakker> |
| Component: | render | Assignee: | Ryan C. Gordon <icculus> |
| Status: | ASSIGNED --- | QA Contact: | Sam Lantinga <slouken> |
| Severity: | normal | ||
| Priority: | P2 | CC: | rtrussell, sylvain.becker |
| Version: | 2.0.3 | ||
| Hardware: | x86_64 | ||
| OS: | Windows 7 | ||
| Attachments: |
testcase
patch patch |
||
|
Description
Marcel Bakker
2015-11-02 17:26:00 UTC
*** Bug 3600 has been marked as a duplicate of this bug. *** Created attachment 3005 [details]
testcase
I have checked with a testcase:
opengl :
- does not draw lines when there are 1 pixel.
- can miss corner points. more than 2, it can miss N points.
opengles2 :
- can miss corner points. more than 2, it can miss N points.
software renderer :
- does not draw lines when there are 1 pixel.
you can also build a line of 1 point by using :
SDL_Point points[] = {{20, 20}, {20, 20}, {20, 20}, {20, 20}};
and then, opengles2 also misses to draw the pixel !
I Suggest the following solution:
- SDL_DrawLines (SDL_DrawLine and SDL_DrawRect) should redirect to SDL_DrawPoints when line are 1 pixel.
- Remove all corner-case code that try to add points at the end of lines, because it's just wrong. so let the driver decides to draw the points or not.
eventually,
in addition to SDL_DrawLines(points), proceed to a SDL_DrawPoints(points) to make sure the point are drawn.
or we can also modify each renderer to always draws vertices, in addition to the lines.
Created attachment 3006 [details]
patch
here's a patch with previous things.
but it can be also written so that drawing all vertices is done in each renderer code.
Created attachment 3007 [details]
patch
the patch, drawing the vertices can be optional
The problem is that some renderers will draw the vertices, depending on the driver, so we'll get double draw of those points, which isn't what we want in the case where there are blend modes applied. The right solution is to switch line drawing to use textures, which is incredibly fast on modern graphics hardware, and can be pixel perfect. *** Bug 3600 has been marked as a duplicate of this bug. *** Can you precise what you mean ? I quickly tried to use a 1D texture with glTexImage1D(), and it still have the same behavior: - doesn't draw 1 pixel lines / misses sometimes vertices and extremities (if I remove the code that explicitly does it). I also switched the GL_LINE_STRIP to GL_TRIANGLE_STRIP. Drawing is incorrect of course, but it shows also that vertices are still not drawn. |