GL_ARB_texture_env_sub?

whats the best way to subtract tex A from B. ie the opposite to GL_ARB_texture_env_add.
cheers zed

Typically, you use GL_MODULATE to make
things darker. However, that does a multiply
by pixelval/255, not a real subtraction, so
if the unnatural lighting behaviour of
subtraction is what you want, you’ll probably
have to look into register combiners.

You may think about using
GL_EXT_texture_env_combine with ADD_SIGNED_EXT:

Arg0 + Arg1 - 0.5

To take that one step further, remember that the combine extensions let you use 1-A in place of A. So:

A + (1-B) - 0.5
A - B + 1 - 0.5
A - B + 0.5

Or, a subtract biased to 0.5 so you can see both negative and positive differences.

  • Matt

cheers dudes. ive got it sussed now.
ill stick up a bumpmapping demo on me site tommorrow using the technique.

ok uploaded it http://members.nbci.com/myBollux/
under ‘demos’