Using pyGame and pyOpenGL, I have created a 2D surface, I used this 815x815 PNG created in Photoshop as a texture:
Here is how I'm loading the image, using pygame, and converting it into a texture.
pygame.init()
display = (800,600)
pygame.display.set_mode(display, DOUBLEBUF|OPENGL)
myTex = pygame.image.load('0.png')
myTex = myTex.convert_alpha()
myTexData = pygame.image.tostring(myTex, 'RGBA', 1)
myTexID = 0
glGenTextures(1, myTexID)
glBindTexture(GL_TEXTURE_2D, myTexID)
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, myTex.get_width(), myTex.get_height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, myTexData)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
Here is the code I'm using to draw the square and the texture.
glBlendFunc(GL_SRC_ALPHA, GL_ONE)
glBegin(GL_QUADS)
glVertex2fv((-1,-1))
glTexCoord2f(0,1)
glVertex2fv((-1,1))
glTexCoord2f(1,1)
glVertex2fv((1,1))
glTexCoord2f(1,0)
glVertex2fv((1,-1))
glTexCoord2f(0,0)
glEnd()
Here is what happens when I run the code.
How do I get the texture to display properly, and why does this happen?
EDIT
It is some kind of transparency error, as changing the background of the image from transparent to white fixes the problem, however, convert_alpha() did not solve the problem. Also, I don't know why this is being downvoted, it is a legitimate question.