Multiply pixel components on front buffer

Hi all,
let’s see what i want to do :
I want to apply a color mask texture on front buffer. This is not a pixel visibility mask, but a pixel’s component one…
For example, if my masking texture is a red one, all pixels which contain no red value on front buffer need to be discard :

current pixel on front buffer : (0,G,B)
current pixel on the masking texture : (R,0,0)

So (0,G,B) * (R,0,0) = (0,0,0)

For the moment, i do this using PBuffer and multiTexturing: i render the scene into the PBuffer, then apply the masking texture on it using multitexturing, which authorize multiplication of pixel components.

But now, i would like to achieve this WITHOUT PBuffering… the main idea is to render a full screen rectangle after the standard scene render process, and to let my Geforce4 multiply pixel components.

Have u got any idea to achieve that ? maybe using TexEnvMap (GL_MODULATE property) or Stencil buffer ?

Another thing, i don’t want to use pixel and vertex shaders…

Thank you for your help !

Originally posted by EricP:
current pixel on front buffer : (0,G,B)
current pixel on the masking texture : (R,0,0)

So (0,G,B) * (R,0,0) = (0,0,0)



blending should do it:



pixelcolor = source* source_factor + destination* destination_factor;

you set source_factor to GL_ZERO and destination_factor to GL_SRC_COLOR which yields :

pixelcolor = framebuffer *red_mask_texture;


[This message has been edited by ScottManDeath (edited 01-31-2003).]