Multitexture Question

Thanks in advance for any help.

The question is: Does Texture0 have to be enabled to utilize Texture1?

More background:
I generate a shadow map and bind it to texture0. Then I render my terrainwith a detail texture bound to texture1. This works fine.

Now I am adding support to render some of the HUD elements. To do this, I switch to ortho and render some textured quads. I disable texture0 (the shadow map) and bind the hud texture to texture1. This fails to work properly. If I only render the HUD by itself using Texture0 it works fine.

Thanks again for any tips…

Originally posted by azcoder:
[b]Thanks in advance for any help.

The question is: Does Texture0 have to be enabled to utilize Texture1?

[…]

I disable texture0 (the shadow map) and bind the hud texture to texture1. This fails to work properly. If I only render the HUD by itself using Texture0 it works fine.
[/b]
The answer to your question is no, you don’t need to have texture unit 0 enabled to have texture unit 1 environment function taken into account:

Texturing is enabled and disabled individually for each texture unit. If texturing
is disabled for one of the units, then the fragment resulting from the previous unit
is passed unaltered to the following unit.

I could be off base, but I think the question for your problem could be more a matter of “Is texture unit ‘n’ enabled if texturing is disabled for that unit?”

If a texture unit is disabled or has an invalid or incomplete texture (as defined
in section 3.8.10) bound to it, then blending is disabled for that texture unit. If the
texture environment for a given enabled texture unit references a disabled texture
unit, or an invalid or incomplete texture that is bound to another unit, then the
results of texture blending are undefined.

So, if texturing is disabled in texture unit 0 and you are trying to perform some colour-only environment function in texture unit 0 or you refer to the texture unit 0 results in texture unit 1 (GL_PREVIOUS), you may not get the results you expect (although I would expect the GL_PREVIOUS case to work, though).

Of course it could also be something more simple like forgetting to send the texture coordinates for texture stage 1 (maybe you are always sending them for stage 0?).

'Of course it could also be something more simple like forgetting to send the texture coordinates for texture stage 1 (maybe you are always sending them for stage 0?). "

:smiley:
Yep - That was it. I needed to use MultiTexCoord.

Thanks for your help