Hugoagogo
Hugoagogo

Reputation: 1646

Pyglet, edge pixels of images are being wrapped

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)

Upvotes: 0

Views: 367

Answers (1)

Constantinius
Constantinius

Reputation: 35039

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?

Upvotes: 1

Related Questions