views:

303

answers:

1

Hey, I'm trying to draw a constant color to the framebuffer and blend it using the alpha channel from an RGBA texture. I've been looking at glBlendFunc and glBlendColor, but can't seem to figure out a way to ignore the RGB values from the texture. I'm thinking I'll have to pull out the alpha values myself and make a second texture with GL_ALPHA. Is there a better way to do this?

Thanks!

A: 

When using glBlendFunc, GL_SRC_ALPHA and GL_DST_ALPHA can be used to select the alpha channel in your texture (which to choose depends on your blend operation and textures). For more detailed blending tutorials see:

The relevant OpenGL documentation:

Clinton
glBlendFunc lets you select different alpha values and how to blend with them, but as far as I know that all affects how you _scale and combine_ the source and destination colors. I'm trying to ignore the source color and blend a different one using only the alpha value from the RGBA texture.
Chris
It sounds like you are trying to mask? See the tutorial #3 link for a section on 'mask on picture'. Is this what you are trying to do?
Clinton