JCipriani2
04-06-2008, 11:10 AM
What I have:
- Alpha mask data, with alpha components that I want to use for a texture.
- Image data that frequently changes, that does not have any alpha components.
- A texture that I frequently update with the image data, using glTexSubImage2D; drawn onto a single, simple quad.
What I want to do:
- Draw the texture using the colors from the image data, with a transparency mask from the original alpha mask.
The image data is updated frequently (in this application, it's frames from a video stream, and the alpha mask is sort of an overlay mask, except I'm drawing the textured quad in aribitrary orientations in 3D space, and it may even be obscured by other things, so I can't just use simple overlays), and performance is important so I don't want to have to manually interleave the image data and alpha mask before calling glTextSubImage2D. The alpha mask is constant the entire time.
Is there something I can do, to combine the alpha components from the alpha mask and the color components from the image? Is there some kind of texture layering or something that helps me with this?
Hopefully I explained that clearly;
Thanks,
Jason
P.S. Some of the parts of the image I want to mask out are not black; so I can't use simple masking tricks that expect the image to have a black background.
- Alpha mask data, with alpha components that I want to use for a texture.
- Image data that frequently changes, that does not have any alpha components.
- A texture that I frequently update with the image data, using glTexSubImage2D; drawn onto a single, simple quad.
What I want to do:
- Draw the texture using the colors from the image data, with a transparency mask from the original alpha mask.
The image data is updated frequently (in this application, it's frames from a video stream, and the alpha mask is sort of an overlay mask, except I'm drawing the textured quad in aribitrary orientations in 3D space, and it may even be obscured by other things, so I can't just use simple overlays), and performance is important so I don't want to have to manually interleave the image data and alpha mask before calling glTextSubImage2D. The alpha mask is constant the entire time.
Is there something I can do, to combine the alpha components from the alpha mask and the color components from the image? Is there some kind of texture layering or something that helps me with this?
Hopefully I explained that clearly;
Thanks,
Jason
P.S. Some of the parts of the image I want to mask out are not black; so I can't use simple masking tricks that expect the image to have a black background.