multitexturing on/off

Ive been playing with some multitexturing last night, something ive been meaning to do for along time. Some q’s for you ppl.

Is multitexturing free? on all cards that support it. I have a geforce card and even with that it seems i am taking a frame hit while multitexturing is enabled.

Can i enclose glActiveTextureARB inside a disply list?

It seems when i want to stop multitexturing I cannot just call
glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);

then continue on with glTexCoord instead of the MT’s glMultiTexCoord2fARB. When i have done this my textures seem rather mixed up. Is this right or am i doing something foolish? The red book tells me that glTexCoord will work on unit 0 if not specified, so i have tried to exploit this by only disabling unit 1.

Thanks in advance,

Dans

[This message has been edited by dans (edited 05-04-2000).]

Dans,

Multitexturing is not guaranteed to be free. It cuts the fill rate in half on GeForce, but I believe it is nearly free on GeForce2.

As for glTexCoord(), it applies to the current active texture, so if you’re disabling texturing in unit 1, but leaving it on in unit 0 and want to use glTexCoord() to set unit 0 texture coordinates, you need:

glActiveTextureARB(GL_TEXTURE1_ARB);
glDisable(GL_TEXTURE_2D);
glActiveTextureARB(GL_TEXTURE0_ARB);

Without the last command, your glTexCoord() calls are setting the texture coordinates for unit 1 (which is meaningless).

Hope this helps…

Yes i see now, i was leaving unit 1 as the active unit so any texture calls were going right down the throat of a black hole.

Calling glActiveTextureARB(GL_TEXTURE0_ARB); brings the default unit0 back into play.

Thanks for your help there, the fill rate hit seems rather a heavy price to pay for what it does. I was under the impression that the GeForce handled up to 4 texture units with no performance decrease, can someone tell me what the story is there?

I am sure i could simulate the effect in a paint programme, using only one texture. Are there other reasons why i should use multitexturing? Or a better question yet is what else can be done with it…

Thanks for your help

I am not an authority on exactly what the impact of multitexturing is on fill rate, but even if it costs twice as much in the rasterization phase, there are distinct advantages:

  1. register combiners math is more powerful than what can be done through blending modes in the frame buffer - it is signed, supports dot products, treats alpha and rgb separately

  2. if you use single texture and blending, you pay (in memory bandwidth consumption)

  3. using combiner math (often with multitexture), you can sometimes develop algorithms that allow you to throw irrelevant fragments away (with the alpha test) before they reach more expensive per-fragment ops like depth, stencil, and blend

And just for clarification, GeForce only supports 2 texture units.

Hope this helps…