We have tests for pixel accuracy of drawPixel and drawLine2D, which still work as expected. So I can only assume that you misinterepreted whether startpoint or endpoint are included in the line or not. Please provide some working code which reproduces the problem.
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
Bug happens as well on Direct3D. Reason seems to be the so called "Diamond exit rule" which does draw lines in a way that connect lines are guaranteed to be connected without ever drawing pixels twice. There are some workarounds (like adding constants), but they are said to have other troubles (like with aliasing). Also that hack didn't work on a quick test here (maybe I messed up....). Or line-drawing has be done completely different (for example with triangles) - which might even allow to have nicer lines on all platforms (but some work - I won't do that right now).
One hack (which we could maybe use internally?) would be to draw each line twice. Once from start to end - then from end to start. Would probably not be that expensive (we do all the setup and data-transfer anyway for each line).
edit: It seems this function has been rewritten several time already. From the commit-logs it seems some patches where even meant to fix that kind of troubles.
edit2: The diamond exit rule also has it's reasons. When mixing line-drawing with blending it is actually useful to never draw a pixel twice.
Last edit: Michael Zeilfelder 2017-06-07
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
We have tests for pixel accuracy of drawPixel and drawLine2D, which still work as expected. So I can only assume that you misinterepreted whether startpoint or endpoint are included in the line or not. Please provide some working code which reproduces the problem.
Reopening. I just tested it and it draws one pixel too short on OpenGL. Works only with other drivers (not yet tested d3d, but software drivers work).
Not yet sure why tests don't fail, but probably they allow some variance which they probably shouldn't for this one.
Test with simple stuff like :
Bug happens as well on Direct3D. Reason seems to be the so called "Diamond exit rule" which does draw lines in a way that connect lines are guaranteed to be connected without ever drawing pixels twice. There are some workarounds (like adding constants), but they are said to have other troubles (like with aliasing). Also that hack didn't work on a quick test here (maybe I messed up....). Or line-drawing has be done completely different (for example with triangles) - which might even allow to have nicer lines on all platforms (but some work - I won't do that right now).
One hack (which we could maybe use internally?) would be to draw each line twice. Once from start to end - then from end to start. Would probably not be that expensive (we do all the setup and data-transfer anyway for each line).
edit: It seems this function has been rewritten several time already. From the commit-logs it seems some patches where even meant to fix that kind of troubles.
edit2: The diamond exit rule also has it's reasons. When mixing line-drawing with blending it is actually useful to never draw a pixel twice.
Last edit: Michael Zeilfelder 2017-06-07