在 AndEngine (Android) 中沿着 TextureRegion 获取额外的线条
我得到了一条额外的线(即1个像素)以及TextureRegions。这是我制作纹理区域的代码。我还尝试在TextureRegions之间提供1像素的填充,但它不起作用。我的图像尺寸是 132x24。
this.txAt_Paddles = new BitmapTextureAtlas(512, 64,TextureOptions.BILINEAR_PREMULTIPLYALPHA);
this.txRg_paddle_left = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.txAt_Paddles, this, "paddle_left.png", 0,0);
this.txRg_paddle_right = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.txAt_Paddles, this, "paddle_right.png", 0,24);
this.mEngine.getTextureManager().loadTexture(this.txAt_Paddles);
谁能指出我在不同纹理区域的不同侧面得到这些线条的原因。这些线并不位于纹理区域的所有侧面。
I am getting an extra line (i.e. 1 pixel) along with the TextureRegions. Here is my code where I am making textureRegions. I also tried to give a 1 pixel padding between the TextureRegions, but it didn't work. The size of my image is 132x24.
this.txAt_Paddles = new BitmapTextureAtlas(512, 64,TextureOptions.BILINEAR_PREMULTIPLYALPHA);
this.txRg_paddle_left = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.txAt_Paddles, this, "paddle_left.png", 0,0);
this.txRg_paddle_right = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.txAt_Paddles, this, "paddle_right.png", 0,24);
this.mEngine.getTextureManager().loadTexture(this.txAt_Paddles);
Can anyone point out the reson why I am getting these lines at different sides of the different TextureRegions. These lines are not on all the sides of the TextureRegions.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
我使用了此处的解决方法来摆脱这些时髦的线条。据我所知,它们只是某处填充不当的结果。我仍在努力理解该解决方案为何有效,但它确实有效!
I used the workaround here to get rid of those funky lines. As far as I can tell, they are just a result of improper padding somewhere. I'm still working to understand why the solution works, but it did!
我不使用 AndEngine,但通常当这种情况发生在我身上时,因为我已将 OpenGL 设置为 GL_NEAREST,这看起来需要目标像素两侧的两个像素来近似颜色。如果同样的事情发生在你身上,它可能看起来距离图像的左/右很远...
尝试使纹理的宽度/高度更小(不是实际的图像尺寸,而是你告诉 AndEngine 的这个尺寸)
I dont use the AndEngine but normally when this happens to me its because I have set OpenGL to GL_NEAREST which looks takes two pixels either side of the target pixel to approximate the colour. If the same thing is happening to you it may be looking to far to the left/right of your image...
Try making the width/height of your texture smaller (not the actual image size but this size you are telling the AndEngine)
您需要使用至少 1 的填充。
我衷心建议您使用 BuildableTextureAtlas。
这是代码
You need to use a padding of at least 1.
I heartily suggest that you use the BuildableTextureAtlas.
Here the code