I am drawing a 2D tiled map
but it have a gap between tiles when zooming in (scale bigger)
zoom out have not problem
I found many thread said that to change the texture filter to GL_NEAREST will solve the issue, it solved in my case,
but i still prefer to use GL_LINEAR because it create better result.
is there any way to fix those gaps but using GL_LINEAR filtering?
i have try (sorry that forgot to mention, i using OpenGL ES 1.x)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WARP_S, GL_REPEAT)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WARP_T, GL_REPEAT)
I used to have that same problem but doesn’t do that anymore. When I was using 2D textures the only way I found to solve it was to:
Adjust the texture size to be larger than the area you want to cover and adjust the texture coordinates to cover a smaller area of the texture so that it samples existing values instead of nothing
Switch filtering to GL_NEAREST
However, I am now using 3D textures and it does not have this issue. I’m not sure if thats what fixed it, it was a while ago.
method 1 solve my problem, i have extend the each tile edge by 1 pixel. although it solve the problem, but I think it not the solution, because it void our tiled map rule and make us have to took more time and resources to recreate the graphics.
sadly that glTexImage3D are not supported on our target platform.
will go for method 2, re-design our graphics resources, use GL_NEAREST on tiled map.
I don’t like the texture resize method either for the same reason, too much trouble. However…
If your target platform supports it, you can enable anti-aliasing fairly easy and that will help make everything look better at a distance. It does cost a little bit of performance though at high values on low end systems.
very strange, it run if I directly
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 2.0f);
without
glGetFloatv(GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT, &fLargest);
if I use glGetFloatv then my Texture class will fail to upload the data to buffer
but even glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAX_ANISOTROPY_EXT, 2.0f) work,
the result seem nothing difference
may be because I am doing 2D(glOrthof)
I was just offering advice to help solve the issue. I already gave another working solution earlier, this was just a suggestion to “possibly” improve the situation.
However, it is true that it is likely not to have much if any effect on 2D tiles.
Or put space between the items in the atlas. It’s not very hard. Two pixels of space, replicating the pixels of their adjacent edge, would be sufficient.