lit texture decals

just searched the forums and while I found multiple threads on combining textures and such, I could not find an answer to " a lit decal"
ie texture put on top of other rendered thru combine/mtex.

in one thread someone said thru combine one could do it without loosing the light information.

but I tried interpolate and still loose light information.

texenv:
tex0 = GL_MODULATE
tex1 = texcombine GL_INTERPOLATE GL_PREVIOUS GL_SRC_COLOR GL_TEXTURE GL_SRC_COLOR GL_CONSTANT GL_SRC_ALPHA;

its kinda logical that the light information is lost, cause of the way interpolate works

I wonder is there a way to do lit decals ?

my picks would be:
combine4_nv,
crossbar (interpolate in tex0 and modulate with light in tex1),
3 stages (add another stage which just does prev modulate light)

is there another way that would work in 2 texunits without vendor specific extensions/crossbar ?

You need two stages and ARB_texture_env_crossbar (or the NVIDIA equivalent), or you need three stages.

Two stages:

  1. TEXTURE1 and TEXTURE0 in DECAL mode
  2. PREVIOUS and DIFFUSE colors in MODULATE mode

(I forget the exact names – these may be the D3D names, but it should be obvious what the operations are).

Three stages:

  1. TEXTURE0
  2. TEXTURE1 in DECAL mode
  3. DIFFUSE in MODULATE mode

The GeForce2 can do the crossbar thing, and the Radeon 7000+ can do either crossbar, or three stages.

There are also vendor-specific extensions that give more flexible texture environment control, and last, there’s the ARB_fragment_program and GLSlang implementations for high-end cards that give you arbitrary flexibility.

got another question in this context
after a little nightmare session on a friends laptop (sis640) and finding out that stuff that works great on NVI or ATI not necessarily (just mtex extension involved) does on others…

but anyway, sis640 driver says it would support GL_EXT_texture_env_combine but when trying it out it doesnt know GL_INTERPOLATE_EXT.

and looking up on with glview, it supports only a fraction of combiners (me wonders why they claim to support env_combine at all if they dont do it fully…)
now I wonder how does glview query which combine funcs are available and not ?
does it just try out all and waits for a glerror or is there another way to find out which combine funcs exist ?