Compositing Bitmap Textures

I am a beginner but that forum could not provide an answer :-

I have rendered an RGBA bitmap to a quad.
A TIFF RGBA image has been loaded and the alpha value of black pixels set to zero.(the TIFF loader insisted on resetting all pixel alpha 0’s to ‘1’).
It is the same size as the previously rendered image.
I am now trying to render all the non-black (i.e.opaque) pixels over the existing image.
All attempts using blending, alpha tests and setting glTexEnv have got nowhere. Very little info on the Net.
Can anyone help ?


David Sykes

If there is data in the frame buffer, then you need to combine the fragments using the framebuffer blend function:

glEnable( GL_BLEND );

glTexEnv() only affects fragments as they’re being generated, which has nothing to do with framebuffer access; the framebuffer only comes in at the very end of the pipeline. Look in the red book for a better description of the fragment pipeline.

Thanks, I am a little confused about fragments and the pipeline.
I had previously tried the method you suggest and it did not work.
You at least confirm that it should work.
(this is quad-buffered stereo incidentally, I don’t suppose that should make any difference ?).

It should work the way described by Jwatte, quad-buffered stereo or not.

Make sure you set up texturing corectly first.

And maybe a more precise description of your problems would help. The screen stays black ? The whole texture appear, even pixels that should stay transparent ?