Ian Mallet: > I'm running into random troubles with PyOpenGL transparency again, and the > simplest solution is just to make the textures have > transparency. Normally, I would just add the transparency in an image > editor, but unfortunately I have ~250 images. My solution is > programming! I wrote a script which should convert all the images to be ~50% > transparent:
Well, here is how you can fill a surface with alpha values in pygame: import pygame screen = pygame.display.set_mode([400,400]) img = pygame.Surface([400,400]).convert_alpha() img.fill([255,255,255]) array = pygame.surfarray.pixels_alpha(img) array[:,:] = 50 del array pygame.image.save(img,"test.png") surface.set_alpha does NOT fill the surface with alpha values, all it does is tell the rendering system to mix the colors when it blits the surface. This is why it won't save those values. But what trouble are you having with transparency in pyopengl? If you use glColor to set an alpha value, you should get the same effect. And it will be more flexible too, such as allowing you to handle things fading in etc. Although I don't know what your problem space is. But if you are having issues such as objects that should be in front displaying behind etc, I don't think making the textures have alpha is going to fix the problem. I think we should look at the original problem instead of trying to work around it.
