hi
i am trying to get transparency with some png images that have alpha
channel. But i just get to see the alpha channel itself. I mean i get
the transparency but the image is black, like all colors but the
transparency have been deleted.
I am importing the images with pygame like this
surface = pygame.image.load(path)
if surface.get_alpha is None:
surface = surface.convert()
else:
surface = surface.convert_alpha()
bin = pygame.image.tostring(surface, "RGBA", 1)
w, h = surface.get_width(), surface.get_height()
textid = glGenTextures(1)
glBindTexture(GL_TEXTURE_2D, textid)
gluBuild2DMipmaps(GL_TEXTURE_2D, 4, w, h, GL_RGBA, GL_UNSIGNED_BYTE, bin)
glTexEnvf(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_BLEND)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
any ideas?
thanks
enrike
|