I am quite new at using OpenGL/GLSL. Basically, the project I am working on is my first 'real' experience with it. I do not know whether this is relevant, but I use libgdx for my project.
Currently, I am trying to use the
GL_LINEAR filters to draw tile of my (tile) map (before I was using
GL_NEAREST without problems).
My map contains diagonal roads (just simple lines in this example). A partial overview/example of my map (using the nearest filter without corrections):
GL_NEAREST filter, initially I added a 1 pixel border, so the tiles were slightly overlapping and the diagonal roads were draw without the small gaps at the edges of the tiles.
This does not work with the
GL_LINEAR filter, because I suppose that the overlapping parts are drawn twice, resulting in a darker 'blob':
I tried to get rid of the blobs, by making the horizontal lines shorter, but there is always an irregularity, either a blob or an 'decrease of line width' (as seen in the diagonal part of the line).
So I removed the 1 pixel additional border and have this as a result:
Now I am trying to fill in the 'gaps' by drawing the two triangular fillers like this:
but I can't get it completely right (this is the best I managed to get):
I suppose it is virtually impossible to get this perfectly right by 'manually' drawing these triangles. Also, when looking at the third image, the lines at the 'edges' (that need to be filled) are very sharp. I suppose this is problematic..?
So, my question is: how does one solve this problem? Do I need to prepare/modify my textures for this? Can I use a shader to fill the gaps automatically? Is manually filling the gaps with the triangles the way to go? Or is there some entirely different technique to have smooth diagonal lines that span multiple tiles?