0

我目前正在使用 Python 开发游戏,并且一直在推迟尝试解决此问题。

出于某种原因,我的图像图块的边缘被缠绕到图像的另一侧。看起来不是很大,只是很小的亚像素量。

这是一个屏幕截图的特写,所以你可以明白我的意思,显然这些简单的瓷砖在某些地方比其他地方更明显(见橙色一侧,可以看到另一侧的道路)

4

1 回答 1

1

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?

于 2011-05-16T13:29:06.813 回答