View Full Version : Alpha blending and masking.
03-26-2003, 01:43 AM
In my app, I currently use alpha blending, just to achieve the normal effect of translucency (glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA)).
In addition, I want to do some masking. Some portions of the screen should be opaque, some translucent. So, I guess I need something like an alpha mask, but without affecting my original blending I described above.
Is there a way to achieve this with destination alpha or some other method?
03-26-2003, 12:57 PM
Additionally, I can say that I am using orthographic projection and do some 2D only. Maybe this helps.
03-26-2003, 07:07 PM
You can use the stencil buffer.
03-27-2003, 12:16 AM
Yes, but is there a possibility to do this with destination alpha? Or what are example applications for destination alpha?
03-27-2003, 11:06 AM
Try looking at Nehe Tutorials. There is a good tutorial about using of alpha mask and effect of transparency. Meaby it's worth looking at.
03-28-2003, 12:14 AM
I haven't really done much alpha stuff but can't you change the blend mode after you have drawn the stuff using the first blending mode to a different more useful one then switch back again?
03-28-2003, 12:54 AM
Well, my problem is how do I apply the alpha mask to the image? E.g. when I first draw the whole scene (which is actually 2D only) then I could switch to a different glBlendFunc() that uses destination alpha and draw a big rectangle over the whole scene. This would apply the alpha mask.
The problem with this approach is it would lead to an effect that I do not desire. I would draw the whole scene first and then apply the alpha mask instead of applying the alpha mask everytime I draw a ... well, lets call it primitive. This would be possible with the stencil buffer, I know, but can you imagine an approach using destination alpha or some other method (except stencil buffer, I actually use it for various other things)?
This would help me a lot.
Powered by vBulletin® Version 4.2.3 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.