We are currently migrating Bugzilla to GitHub issues.
Any changes made to the bug tracker now will be lost, so please do not post new bugs or make changes to them.
When we're done, all bug URLs will redirect to their equivalent location on the new bug tracker.

Bug 4976 - OpenGL SDL_RenderDrawLine (& Rects) some lines too short or long
Summary: OpenGL SDL_RenderDrawLine (& Rects) some lines too short or long
Status: RESOLVED DUPLICATE of bug 2711
Alias: None
Product: SDL
Classification: Unclassified
Component: video (show other bugs)
Version: HG 2.0
Hardware: x86 Windows 10
: P2 critical
Assignee: Ryan C. Gordon
QA Contact: Sam Lantinga
URL:
Keywords: target-2.0.12
Depends on:
Blocks:
 
Reported: 2020-02-12 12:51 UTC by Anthony @ POW Games
Modified: 2020-02-12 20:14 UTC (History)
1 user (show)

See Also:


Attachments
Example of bug (15.34 KB, image/png)
2020-02-12 12:51 UTC, Anthony @ POW Games
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Anthony @ POW Games 2020-02-12 12:51:10 UTC
Created attachment 4207 [details]
Example of bug

Just tested the very latest mercurial; the recent changes to the OpenGL line drawing has regressed into an old bug where some lines are too short and some are too long, depending on the direction of the line. Direct3D & software lines are perfect, it only affects OpenGL. Hard to describe, so I've uploaded a PNG to demonstrate and compare between OpenGL & Direct3D. It even affects the lines of a SDL_RenderDrawRect call. Image is scaled up x3. I made a vector font renderer that draws letters using lines, which also demonstrates the added and missing pixels.
Comment 1 Anthony @ POW Games 2020-02-12 12:57:49 UTC
On closer inspection, it seems like some lines are being shifted a pixel forward? so the starting pixel is skipped and an extra pixel is drawn on the end.
Comment 2 Ryan C. Gordon 2020-02-12 19:11:02 UTC
Hmm, I think we might have to pull the fix for Bug #3182, ship 2.0.12, and then revisit this. Clearly different renderer drivers have different ideas of what the line's range should be (for example, a line from 0,0 to 0,10: should it be 10 pixels long or 11?).

The patch I made the other day made that test case match the software renderer, but it's not clear to me what corner cases there are and if other renderers match (or even if the software renderer is what we _should_ match), and a closer examination of all the renderer drivers is necessary for that.

--ryan.
Comment 3 Sam Lantinga 2020-02-12 20:09:21 UTC
It looks like the diamond exit rule isn't quite what we need...
Comment 4 Ryan C. Gordon 2020-02-12 20:14:56 UTC
Going to mark several bugs as "duplicates" of Bug #2711, since they're all "render API lines are off by a pixel in one way or another," so we're all looking at the same thing. We'll discuss further over there!

--ryan.

*** This bug has been marked as a duplicate of bug 2711 ***