[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [pygame] Pygame surfaces as PyOpenGL textures?



On Sat, 10 Nov 2001, Pete Shinners wrote:

>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?

This sounds good. I will try this tomorrow when I get back to the machine
where I have pyopengl installed. If that is supposed to work the error is
somewhere else, most probably in my non-existent OpenGL knowledge.

Thank you (again) for your help!

-- 
    - "Remember -- that which does not kill us can only make us stronger."
    - "And that which does kill us leaves us dead!"
                                           -- Terry Pratchett, Carpe Jugulum

____________________________________
pygame mailing list
pygame-users@seul.org
http://pygame.seul.org