[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [pygame] Pygame surfaces as PyOpenGL textures?
Jan Ekholm wrote:
> However, no terrain without trees. Simple trees are easiest to do with a
> single billboarded texture. It does need to be partially transparent
> though. So, the problem is how I can get pyopengl to use a texture that is
> partially transparent. Ideally I'd like to use simple colorkey
> transparency, i.e. set a color as transparent. That part works nicely
> in pygame.
i've written the "tostring" function so it does/should respect any
colorkey. after you've got the image as a string, try this.
imgstring = pygame.image.tostring(img_with_colorkey, "RGBA")
print 'PIXEL:', [ord(x) for x in imgstring[:4]]
this will print you the RGBA values for the corner pixel. assuming it is
"transparent" it should get you something like "PIXEL: [255, 0, 255, 0]"
maybe check some of the other pixels, and make sure the alpha value is
"255" where you expect it to be?
____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org