when i draw a texture, its four edges also show(four white dot lines), how to let these edges do not show?
BTW: If both the width and height of the texture’s original picture are two to the power of N,(ie, 12864, 256256), then there are no edges appear, but if either of the width and height of the picture is not two to the power of N, (ie, 4032, 120120), then when i draw the texture, there are four edges shown. How to solve this problem? Thanks a lot!
You should say that you use OpenGL ES, and that you can not use NPOT textures.
This is due to linear interpolation. If you use nearest interpolation, the problem should disappear but it is not a good solution.
Texcoord clamping can not work in this case, so either you clamp yourself on the fragment shader (not possible on GL ES < 2), either you manually duplicate the 4 line of texels around your “valid” part. It must be done on each mipmap level by the way.
Alternatively, if you’re creating the content yourself, why not make the while thing a lot easier by just resizing the images to powers of 2 in an image editor? You’ll likely get higher quality than if you did it in the app, and it’ll create less overhead when rendering.
“so either you clamp yourself on the fragment shader (not possible on GL ES < 2)”
My hardware only supports GL ES 1.0, so i can’t use this method.
“either you manually duplicate the 4 line of texels around your “valid” part. It must be done on each mipmap level by the way.”
sorry for that i dont understand this paragraph and dont know how to do it.
let’s try ascii art :
your current texture is like this, with ‘0’ texels being undefined (because only here to make a POT texture) and X and 123456789A your data :