I am currently attempting multitexturing. I set up part of a 3d scene using glActiveTextureARB, and called glEnable(GL_TEXTURE_2D) just after. But now i am getting some strange results when i want to go back to my 2D GUI setup. If I call glActiveTextureARB and disable texture 2d right afterwards, i get NO textures in my gui. If i call a glenable texture 2d inside the gui calls, i get colors but not textures. Is there a way to turn off the glActiveTextureARB?? or am i simply not doing something right??
You just disable the texture units you don’t need, that’s all.
Also make sure that when you disable your second/third/… texture unit, you switch back to unit 0 before rendering single-textured geometry. E.g.
glActiveTexture(GL_TEXTURE1); glDisable(GL_TEXTURE_2D); glActiveTexture(GL_TEXTURE0); glBindTexture(GL_TEXTURE_2D, yourGUItexture); // Now render stuff.
It helps to think of unit 0 as the default active texture.Consequently,
are implicit when writing non-multi-textured
Ok, so maybe my problem when i go back to the GUI is that i also call…
Should i “never” disable the first texture? Could this be causing my problem? But if i do disable it,would calling glEnable(GL_TEXTURE_2D) fix that, cause when i do that, i only get colors. (Sorry i would simply check to see what works, but im currently working at a computer that dosnt have multitexturing, and ownt be able to check it till this evening)
Disable all available texture units, by doing this:
for (int i=0; i<MAXTEXTUREUNITS; i++)
then, if your gui text requires texturing (which I assume it does, you probably have each character stored in a texture), do this:-
That will definitely work.
Ok i think i found my problem. I wasnt disabling the glClientActiveTextureARB. So it must have been using the same thing in my gui. What i am doing now, is i enable texture 2D when the program loads. When i go to my game, i enable all the textures needed, then diable ALL of them. Then when i go back to my gui, i simply call glEnable(TEXTURE_2D) again, hopefully that will work. If not i will simply re enable the first texture unit when i go to my gui.