modulation with pixel/vertex/texture shading

Hello,

I am using vertex programs, register combiners, and texture shaders in a multi pass rendering algorithm.

For the very last pass, I would like to do a simple modulation between a texture and the result from the previous rendering passes.

A simple modulation setup doesnt work. i.e,

glActiveTextureARB(GL_TEXTURE0_ARB);
glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE);

Regardless of the last parameter of the glTexEnvi function, the texture is always ADDED to the previous fragment.

Given the info above, could anyone point out how to modulate between a texture and the result of multiple passes?

thx

Use blending ( glBlendFunc ) for combining multiple passes:

glEnable( GL_BLEND );
glBlendFunc( GL_DST_COLOR, GL_ZERO );

OR

glEnable( GL_BLEND );
glBlendFunc( GL_ZERO, GL_SRC_COLOR );

assuming you’ve stored the previous pass in the RGB portion of the framebuffer. With all those fancy NVIDIA extension you’re using, I thought you would have known about blending ( unless I misunderstood your question ).

>>> With all those fancy NVIDIA extension >>> you’re using, I thought you would have >>> known about blending ( unless I
>>> misunderstood your question ).

you would think…

Thanks.