Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Alpha blending with external mask

61 views
Skip to first unread message

Wander Lairson

unread,
Aug 1, 2012, 9:27:25 AM8/1/12
to
Hello,

I am a OpenGL beginner and I am porting a legacy company internal 2D graphics library to use OpenGL under the hoods. One of the functions exported by this legacy API is one that takes an image in RGB format, and another "alpha mask" image in 8 bits per pixel. The colors in the mask represent the alpha channel to be used when blending the image with the color buffer. So, the operation I would like to do is to perform alpha blending between my image and color buffer with, as alpha channel, a data that comes from a third image with 8 bits per pixel (so the alpha value ranges from 0 to 255).

I have been playing with glBlendFunc and glBlendFuncSeparate, but yet couldn't get the result I wish. Does anyone have an idea how to perform this operation as fast as possible?

Thanks in advance,
Wander Lairson Costa

fungus

unread,
Aug 1, 2012, 10:18:09 AM8/1/12
to
On Wednesday, August 1, 2012 3:27:25 PM UTC+2, Wander Lairson wrote:
>
> I have been playing with glBlendFunc and glBlendFuncSeparate, but yet couldn't get the result I wish. Does anyone have an idea how to perform this operation as fast as possible?
>

Multitexture. Have two textures at once!

jbwest

unread,
Aug 13, 2012, 8:24:41 PM8/13/12
to

"Wander Lairson" <wander....@gmail.com> wrote in message
news:5cc3c96e-bf1c-49f3...@googlegroups.com...
If you can make an RGBA texture from combining them, then use gltexEnv(),
GL_DECAL i think, to apply.


Lars Pensjö

unread,
Sep 10, 2012, 7:30:35 AM9/10/12
to
That is, you can bind two textures at the same time (using glActiveTexture+glBindTexture, and then the shader creates the RGBA value.

You are using shaders, aren't you?

fungus

unread,
Sep 10, 2012, 12:43:04 PM9/10/12
to
On Monday, September 10, 2012 1:30:36 PM UTC+2, Lars Pensjö wrote:
> You are using shaders, aren't you?

You don't need shaders for this. The
register combiner extension will do
the job if your program isn't shader
based.

0 new messages