Multitexture and Reflections

To begin with, I know how to use multitexturing to produce lightmapped textured polygons.
What I’m trying to do is making lightmapped textured polygons PLUS reflection mapping.

For now, I’m doing this:
glDisable(GL_LIGHTING);
// colormap
glActiveTextureARB(GL_TEXTURE0_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, colormap);
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_REPLACE);
// lightmap
glActiveTextureARB(GL_TEXTURE1_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, lightmap);
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_MODULATE);
// reflectionmap
glActiveTextureARB(GL_TEXTURE2_ARB);
glEnable(GL_TEXTURE_2D);
glBindTexture(GL_TEXTURE_2D, reflectionmap);
glTexGenf(GL_S,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP);
glTexGenf(GL_T,GL_TEXTURE_GEN_MODE,GL_SPHERE_MAP);
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glTexEnvfv(GL_TEXTURE_ENV,GL_TEXTURE_ENV_COLOR,CGLVector(1,1,1,1));
glTexEnvi(GL_TEXTURE_ENV,GL_TEXTURE_ENV_MODE,GL_BLEND);

(okay, some lines are missing, but you got the idea)

Without the ‘reflectionmap’ section, everything is correct (ie a superb greyish cub with a lighting gradient on it)

But with the ‘reflectionmap’, I see a full illuminated cube with a reflection map.
The lightmap vanished ???

I read and read again all the specs I could find. Tuned all parameters I could of… No way…

Save me !!! Help !!! glub glub glub (sinking)

Just a guess, but most graphics cards support only 2 textures at once. That could be the cause of the problem.

Or it could be because of the way you are using the blend mode on the final texture.

I’m not sure, but I think that the GL_BLEND texture blend mode modulates the current texture with a constant color and then applies it. This would mean that you are modulating your reflection map with the color white and then applying it on top of the other textures, which would look the same as what you describe. Even if it modulates the texture by the blend color and then blends the result with the previous texture, using a alpha value of 1 would still mess that up (I think).

Maybe try to put the transparency into the reflection map as an alpha channel set to about 50% transparency, and use the GL_DECAL texture environment.

ACtually, I have a GeForce2/64M, so it should
have 4 Textures Unit, so I think this is not the problem.

For the TEX_ENV mode, I tried with DECAL, BLEND, REPLACE (just to say : I tried), even tried with GL_ADD (as ARB_texture_env_add is supported). No way !

I searched for some example code, but all tutorials are showing the easy lightmap (2 texture units only).

I’ll try with the transparency trick…

The GeForce2 only has two texture units. It has four pixel pipelines for it’s per-pixel shading.

-Won

Gulp. Okay. My fault.

So, I’ll have to get back to multi-pass, I guess…

Thanks for the input !

Having only 2 TMU doesn’t prevent you to do 100 texture pass on a given polygon…