0
votes

In opengl es on andrid when I place two textures next to each other there is a slight seam in which you can see drawn objects behind them. Basically looks like a small gap. I narrowed it down to the mipmapping

glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR); glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);

If I set them both to GL_NEAREST the seam goes away but the textures look like crap. Do I have any other options here?

1
Are your objects grid-aligned?Ben Voigt
What are your values for GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T? You may want to try to set them to GL_CLAMP_TO_EDGE if you're not doing that yet.Reto Koradi
@RetoKoradi THANKS! That did the trick.NJGUY

1 Answers

1
votes

The sampling behavior at the edge of the texture depends on your texture wrap settings, which you can set with glTexParamteri(), using GL_TEXTURE_WRAP_S and GL_TEXTURE_WRAP_T for the parameter name. These control the wrap mode for the two texture directions separately.

The default value for these parameters is GL_REPEAT, which creates a repeating pattern of the texture. This means that when you approach for example the left edge of the texture, and reach the last half texel, linear interpolation will happen between the leftmost and rightmost pixel. This is most likely causing the seams in your case.

The other valid values in ES 2.0 are GL_MIRRORED_REPEAT and GL_CLAMP_TO_EDGE. Both should work better for your case, but GL_CLAMP_TO_EDGE is the most straightforward. It will simply use the texel at the edge while approaching the edge, without any interpolation for the last half texel.

You can set these parameter values with:

glTexParamteri(GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
glTexParamteri(GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);