Definately possible. One thing that took me a while was to get the image
imported in the right (RGBA) format. I have these snippets:
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA )
textureSurface = pygame.Surface(destination_dim, pygame.SRCALPHA, 32)
textureSurface.fill((0,0,0,0))
textureSurface.blit( sourceSurface, (x_offset,y_offset), (frame_min_x,
frame_min_y, sprite_width, sprite_height) )
textureData = pygame.image.tostring(textureSurface, "RGBA", 1)
glBindTexture(GL_TEXTURE_2D, textures[i])
glTexImage2D( GL_TEXTURE_2D, 0, GL_RGBA, textureSurface.get_width(),
textureSurface.get_height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, textureData );
glEnable( GL_BLEND )
glEnable( GL_ALPHA_TEST )
glAlphaFunc( GL_GREATER, 0.1 )
glEnable(GL_TEXTURE_2D)
glBindTexture( GL_TEXTURE_2D, texture )
Hope that helps. glAlphaFunc is key.
-austin
> Is per pixel alpha transparency on textures possible?
>
> I've investigated glBlend and glTexEnvfv, but neither come up with the
> results i expected.
>
> What do other people do to achieve this?
>
> Sw.
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: NEC IT Guy Games.
> Get your fingers limbered up and give it your best shot. 4 great events, 4
> opportunities to win big! Highest score wins.NEC IT Guy Games. Play to
> win an NEC 61 plasma display. Visit http://www.necitguy.com/?r
> _______________________________________________
> PyOpenGL Homepage
> http://pyopengl.sourceforge.net
> _______________________________________________
> PyOpenGL-Users mailing list
> PyO...@li...
> https://lists.sourceforge.net/lists/listinfo/pyopengl-users
>
|