Why does one edge of my, er, 'player' sprite (the green cube) sometimes display a white line alone one diagonal, whereas at other times is doesn't. There's only one place in the program where the image is drawn so it's not something I'm doing in code.
Rendering issue
Re: Rendering issue
Drawing the sprite at non-integer coords?
Re: Rendering issue
Yes indeed; if I use ints everything is fine. I just read this [1], which sort of explains it - the fix is certainly easy enough. I think my understanding of how/where images are drawn is flawed - I was expecting draw() to place the image at the nearest integer position by default so x,y of 100.3, 100.1 would draw at 100,100 whereas 100.7, 100.1 would draw at 101, 100. Thanks for the clue anyway
[1] viewtopic.php?t=79661
Re: Rendering issue
I don't think it was flawed, assuming you used the nearest filter. The problem typically shows up around n + 0.5 (e.g. 100.5), because due to rounding errors and floating point precision, some numbers are rounded up and some others are rounded down, and that discrepancy causes the visual artifacts.mr_happy wrote: ↑Sun May 13, 2018 7:04 am I think my understanding of how/where images are drawn is flawed - I was expecting draw() to place the image at the nearest integer position by default so x,y of 100.3, 100.1 would draw at 100,100 whereas 100.7, 100.1 would draw at 101, 100. Thanks for the clue anyway
Re: Rendering issue
Thanks pgimeno, it just seems odd that the artefact is a 'white' line... I'd expect some sort of dithering of the black edge. No matter, easy enough to fix
Who is online
Users browsing this forum: No registered users and 2 guests