Two Depth textures: Problems with different compare functions


I have applied two depth textures in texture unit 0 and 1, and used the GL_COMPARE_R_TO_TEXTURE_ARB mode of the ARB_shadow-extension for both texture units. Then I have noticed that I cannot use different texture compare functions, for example, GL_LEQUAL or GL_GREATER, for the different depth textures. It seems that one function is always used for both texture units.

Is this

  1. missing in the specification,
  2. a problem of the hardware (GeForce3TI 200),
  3. or a driver bug (NVidia 42.86)?


Using something other than LEQUAL or GEQUAL requires the EXT_shadow_funcs extension. On GeForce3s there are some HW limitations according to spec on NVIDIAs site,

NV20 (GeForce3 and Quadro DCC) will fallback to software rasterization
if two or more texture units have distinct TEXTURE_COMPARE_FUNC_ARB
settings that are not opposites (eg, GL_EQUAL and GL_NOTEQUAL).
This is not an issue on NV25 (GeForce4 and Quadro4).

So it seems it should work, just in software mode on GeForce3 ( for the values you posted ).

GL_TEXTURE_COMPARE_MODE_ARB is a texture parameter, not a texture environment setting, so it has nothing to do with what texture unit you apply it to. When you set the compare function, it’s applied to the currently bound texture, not to the currently active texture unit. Are you sure you’re not getting that mixed up?

– Tom

Thank you, Tom. What you describe has been the problem!