Doing multitexturing with ARB_multitexture

One serious question: how would one use it only some of the time?

I’m planning to use it to implement glow mapping, by painting a texture shaded with glColorxx() and transfer mode GL_MODULATE, and then one with transfer mode GL_DECAL or GL_REPLACE.

However, many of the textures will not be glow mapped, and I’d like to know how to shut down multitexturing when I don’t need it.

Finally, how widely-supported is ARB_multitexture? It’s supported in Apple OpenGL; how well is it supported by various Windows and Linux OpenGL drivers?

That’s a very good question. I’m having the same kind of problem. If worse comes to worse and there are no way to turn it off, then I guess one way is to set the “unused” texture units’ environments to something that won’t effect the final result.

…but I’m very keen on finding a better sollution as well.

Here is the answer about using ARB_multitexture, http://www.berkelium.com/OpenGL/GDC99/multitexture.html About your first question, you really don’t shut down multitexture. When your app starts you get the pointers to the multitexture functions and thats it, you never have to start anything. A really simple solution to your problem is to always render using multitexture, but only activate one texture and then activate the second when you need it. The problem with that is cards that don’t support ARB_multitexture wont be able to run your app. Multitexture is only on when you want it to be on, you just have to issue the multitexture calls and multitexture will be used. Hope this helps somewhat, I don’t know if I am repeating something you already know…

Nate http://nate.scuzzy.net

What Nate said is right, but just to elaborate, the ARB_multitexture extension is only about getting access to other texture units. That is, in single texture OpenGL, you can think of there being only one texture unit. When you want texture on, you just specify a texture with glTexImage{12}D(…) then enable texturing via

glEnable(GL_TEXTURE_{12}D);

and you disable it with the corresponding glDisable() call. ARB_multitexture introduces the concept of an “active texture unit” (which defaults to GL_TEXTURE0_ARB) and
each texture unit’s state can be set by first setting it as the active texture unit, then using the regular OpenGL commands to specify the texture image, texture env, texgen, etc.

That’s really all there is to it. ARB_multitexture does include entry points for passing in texture coordinates because it would be unwieldy to have to keep changing the active texture and using glTexCoord() inside a tight rendering loop.

So to answer your question more specifically, to turn off texturing in the second texture unit, just:

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

Hope this helps…