开发者

Pyglet, edge pixels of images are being wrapped

开发者 https://www.devze.com 2023-03-06 00:37 出处:网络
I am currently 开发者_运维知识库working on developing game with Python and have been putting off trying to fix this issue.

I am currently 开发者_运维知识库working on developing game with Python and have been putting off trying to fix this issue.

For some reason the very edge of my image tiles are being wrapped around to the other side of the image. Not by a large amount just by a tiny sub pixel amount it seems.

Here is a close up of a screen shot so you can see what I mean, obviously with such simple tiles as these it is much more noticeable in some places than others (see the orange side where the road from the other side can be seen)

Pyglet, edge pixels of images are being wrapped


This problem is due to minor floating point accuracy problems, at the edges of the image. OpenGL has to interpolate against some value at the edges where no further values are given. The normal operation is GL_REPEAT, which means a wrap around effect for the texture. What you want is GL_CLAMP, but this has to be stated at the time the texture is created, afaik.

glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, CL_CLAMP )
glTexParameterf( GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP )

unfortunately I do not know how you can integrate this with pyglet. Maybe there are creation options?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号