Closed inkeliz closed 5 years ago
Thanks for this very detailed issue! I believe it has something to do with the way the viewport is calculated in the sprite sheet, probably something to do with float rounding. I'll take a look when I have some time
I don't have any experience with graphics or developing games. I guess that the float is the problem, but even choosing some points like {1, 1} the same "lines" appear, with sprites (not images).
I could fix that problem by changing the function:
func (s *basicShader) Draw(ren *RenderComponent, space *SpaceComponent) {
//...
}
The original file has one switch to trigger the engo.Gl.NEAREST
:
if s.lastMinFilter != ren.minFilter {
s.flush()
var val int
switch ren.minFilter {
case FilterNearest:
val = engo.Gl.NEAREST
case FilterLinear:
val = engo.Gl.LINEAR
}
engo.Gl.TexParameteri(engo.Gl.TEXTURE_2D, engo.Gl.TEXTURE_MIN_FILTER, val)
}
I just replace that switch to:
engo.Gl.TexParameteri(engo.Gl.TEXTURE_2D, engo.Gl.TEXTURE_MIN_FILTER, engo.Gl.NEAREST)
I'm searching how to trigger that if
and switch
correctly. I'm just pointing out that change fixes the issue. I'm not aware of any unintended effect of that change, more tests are needed.
I tested the "TrafficManager" demo, then I notice one bug when move (using the mouse at the edge of the screen) or zoom-out (using the mouse wheel). However, that bug ONLY happens against "sprites".
I use the following code to reproduce that issue:
That is the result:
When I use the image, there are no such "lines" between these images. Using "images": I'm able to move, zoom and zoom-out without issue. However, the "sprites" display some "lines" at random.
The full code:
The assets are from https://opengameart.org/content/map-pack-180-assets, just download the zip and extract "PNG" and "Spritesheet" to "assets".