views:

583

answers:

2
+1  A: 

If you have a normal ol' texture with alpha, and you're rendering in back-to-front order, this is the way to go:

glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)

If your texture has premultiplied alpha, and you're rendering in back-to-front order, do this instead:

glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA)
prideout
Now that I've studied blending a little bit more this is probably the closest I can get. I've also realized that the reason the explosion rendered on black background looks the way it does is because how it blends with the background.
Jens Utbult
A: 

From opengl.org

You might want to use the alpha values that result from texture mapping in the blend function. If so, (GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA) is always a good function to start with.

However, if you want blending to occur when the primitive is texture mapped (i.e., you want parts of the texture map to allow the underlying color of the primitive to show through), then don't use OpenGL blending. Instead, you'd use glTexEnv(), and set the texture environment mode to GL_BLEND. In this case, you'd want to leave the texture environment color to its default value of (0,0,0,0).

slf