the origin size is 250 * 30, but output size is 254 * 34, the four direction edge have 2 transparent pixels.
I have not found the solution now, but I want to update my research by now. There are some similar issues happened and people either enable CC_FIX_ARTIFACTS_BY_STRECHING_TEXEL or setAntiAliasTexParameters() (implemented by use GL_LINEAR Filtering mode internally) to cover it, but it seems as hack fix.
Hope this I have refined the test case on my branch.
I know extrude in texture packing software can solve these problems to an extent. It's like the rect is offsetting by 1 pixel higher each frame then correcting itself.Īnother thing, how does the anti aliasing work in cocos? Maybe when you apply anti alias to a sprite frame wouldn't it mix in pixels from other sprite frames outside the sprite frame. It's the top edge of pixels from the frame directly above in the sprite atlas that are drawn, so the sprite frame you test needs to have another frame above it. Make sure to disable anti aliasing on the sprite frames so the pixel edges are clean. Make sure to move the camera by 0.05f every frame, this made the bug most noticeable for me, I think it's because this slow movement allows you to see exactly when the sprite gets redrawn at the next line of pixels. Here's a couple of things about reproducing the bug, make sure to move the camera up or down on the Y-axis, problem doesn't appear on the x-axis movement (this may give clues to fixing it). Thought I'd add a few more comments on this problem. My first thought was floating point innacuracies in the shader or something. It's also worth mentioning that the problem appears to happen rather sporadically, i.e. It's worth mentioning the problem appears to go away if running on the iOS simulator or in Win32, hopefully that may help to fix it.
I have also tested it on an Android device (Samsung Galaxy Tab 4 10.1) and it still happens. Then move the camera every frame on the y-axis, I moved it up (+0.1f). It should be fairly simple to reproduce, export a texture pack (sprite atlas) with a few images. I'm 99% it's something going wrong in the Cocos2D-x engine.
I've tried every option in TexturePacker and I'm convinced that's not the problem. There is a visible offset of the spriteframe and I know the rect is changing because I can see the first line of pixels from the frame above that particular frame in the sprite atlas is getting drawn. It doesn't happen consistently every frame, but maybe every 4-5 frames. If I move my Cocos2d::Camera (orthographic) in the Y axis the rect for each sprite frame appears to be changing its offset 1 by pixel. I am using a sprite atlas exported from TexturePacker. I encountered this problem when I started cutting the level in my game in to smaller peices.