Very stange TMUs

I’m experiencing a very strange behavior.
I’ve two TMU’s enabled for cube mapping on the first pass. The second pass requires only the first TMU; and disabling the second TMU drops down the performance from 60/70 fps to nearly single/sec. This happens only when I disable it. What’s wrong?
My 3d card is GeForce 2 MX
OpenGL driver version 1.3 (latest)

Are you resetting the 1st TMU as the active texture unit, after you’ve disabled the 2nd?

Yes. TMU0 is initially enabled for 2D texuring and cube-mapping. On the second pass, I disable both TMU0 and TMU1 cube-mapping, leaving TMU0 only enabled for 2d texturing.

For disabling cube mapping, you could just call

glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0);

because that has pretty much the same effect as calling


My stupid question of the day:
why do you have both 2D and CUBE_MAP_ARB texture modes enabled at the same time on TEXTURE0_ARB?!?!


I’m trying to do per pixel lighting. The first pass requires both TMU0 and TMU1 to dot product normalized vectors. The second
rendering pass requires 2d texturing enabled for TMU0 to blend a decal texture.
I think it would be faster to disable TMU0-cube-map instead of rebinding a 2d texture object.

OK, that answers that. Well, what you could try to do is on your first pass…

glBindTexture(GL_TEXTURE_2D, 0);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, tex1num);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, tex2num);

Then on your second pass, you could try this…

glBindTexture(GL_TEXTURE_2D, tex3num);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0);
glBindTexture(GL_TEXTURE_CUBE_MAP_ARB, 0);

Binding to texture 0 shouldn’t cause any rendering problems (hopefully.) Although I would think that there might be a small performance hit because the extra texturing is still enabled in both the first and the second passes. But it certainly shouldn’t be as bad as going down to ~1 frame/sec. Something else you should try is see if you can benchmark your own program to see if keeping TEXTURE_2D disabled, then enabling TEXTRE_2D and disabling TEXTURE_CUBE_MAP_ARB and seeing if there is much of a speed difference. From what it sounds like your saying, your GF2MX is sampling TEXTURE_2D with the same texcoords as your using for TEXTURE_CUBE_MAP_ARB, except that your TEXTURE_CUBE_MAP_ARB is replacing the pixel value used, so you’re actually wasting some texturing power sampling that extra 2D texture, unless there’s some way of telling OpenGL to not sample an active texture?


I tried your suggestion and bound TMU1 cube-mapping to the default texture name 0.
I got undesirable results. It seems that TMU1 is still enabled but with a different texture. And since it’s not disabled, no weird frame rate drop down.