PDA

View Full Version : Compositing Bitmap Textures



Microfunguy
09-09-2003, 01:03 PM
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 ?

Thanks,

David Sykes

jwatte
09-09-2003, 02:10 PM
If there is data in the frame buffer, then you need to combine the fragments using the framebuffer blend function:

glEnable( GL_BLEND );
glBlendFunc( GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA );

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.

Microfunguy
09-09-2003, 03:36 PM
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 ?).

ZbuffeR
04-18-2004, 07:39 AM
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 ?