I’m using ImageView for showing images.
But sometimes strange weired line appear for some images.
Also, I’m using clipping node for masking images, but weired line appear for masking images, too.
When OpenGL samples your texture, interpolation or rounding errors can cause the UV lookup to read from a texel outside your UV range.
For single images this is usually combatted by ensuring texture wrapping is set to GL_CLAMP_TO_EDGE (cocos2d-x does this for you by default). However if you generate mipmaps or perform any minimising yourself, edge artifacts can occur, in which case you’ll want to add a 1 pixel transparent border to your texture.
For spritesheets; as you cannot configure GL to clamp to a sub section of a texture, it is common practice to add a fully transparent spacing between sprite frames. This way when a lookup overflows the spriteframe’s bounds it reads into the transparent texels instead of the adjacent frame’s data. Typically this spacing is 2 pixels.
The TexturePacker documentation visualises this pretty well, see the link for more details:
Boarder Padding “…is the space between the sprites and the border of the sprite sheet”
Shape Padding “…is the space between sprites. Value adds transparent pixels between sprites to avoid artifacts from neighbor sprites”
Inner Padding “…adds transparent pixels to the inside of the sprite”
Hi, almax27
Thanks for your reply.
I’m using spritesheet created by Cocos Studio.
When I create spritesheet in Cocos Studio, I did use default setting.
I set space to 1 px in cocos studio, and issue is fixed.