I tried to get into pyglet and opengl and come up with weird results when drawing a simple triangle with a texture. When drawing the triangle the texture appears to have black border. I tried to change min/mag_filter but there is no effect on the border. Am i missing something important here ?
img = pyglet.image.load('test.png')
tex = img.get_texture()
#left triangle
vert = [0,0,0,100,100,100]
#right triangle
vert2 = [200,0,200,100,300,100]
uv = [0.0,0.0,0.0,1.0,1.0,1.0]
img.blit(200,200)
pyglet.gl.glDisable(tex.target)
pyglet.graphics.draw(3,pyglet.gl.GL_TRIANGLES,('v2f',tuple(vert2)))
pyglet.gl.glEnable(tex.target)
pyglet.gl.glBindTexture(tex.target,tex.id)
pyglet.graphics.draw(3,pyglet.gl.GL_TRIANGLES,('v2f',tuple(vert)),('t2f',tuple(uv)))
Most likely it's pyglet padding your texture out to the next power of two and filling the rest of the texture with black instead of stretching.
There are two solutions to this problem, both of which I answered on an earlier SO question regarding LWJGL: Texture doesn't stretch properly. Why is this happening?