PDA

View Full Version : Blending and the Frame Buffer



Microfunguy
09-14-2003, 01:29 AM
In a previous post http://www.opengl.org/discussion_boards/ubb/Forum2/HTML/013930.html I asked how I could render a bitmap with 'transparent' areas over an image already rendered to a quad.
As no-one knew the answer, can I put the question a different way ?
As soon as the first image is rendered to the quad, does it exist in the frame-buffer ?
When I then enable blending and set glBlendFunc(GL_SRC_ALPHA,GL_ONE_MINUS_SRC_ALPHA) and render the second image with 'transparent' areas to a quad in exactly the same position, it merely overwrites it.

Is blending only applied to these mysterious 'fragments' and what are the fragments in this situation ?

Thanks,
David Sykes

Bob
09-14-2003, 04:09 AM
Well, two obvious questions would be:

1: Is blending enabled?
2: Does the second texture have an alpha channel with values other than 1?

edit: OK, you said you enabled blending, missed that, so skip 1. But second Q still remains. Does it really have a proper alpha channell?

[This message has been edited by Bob (edited 09-14-2003).]

Microfunguy
09-14-2003, 07:01 AM
Well, initially the TIFF loader set the alpha of all pixels to '1', including the black pixels which in the original file are transparent.
So, I changed all occurrences of 0x000000FF to 0x00000000 before binding to the second texture (i.e. all black pixels made transparent).
I guess for testing, I need to check this somehow.

You seem to be saying that if my second texture really does have an alpha channel this should work ?