Texturing although GL_TEXTURE_2D off?


I am implementing opacity shadow mapping in conjunction with another lighting shader, and have a wierd bug I’m hoping you can help with.
Due to the opacity mapping my render is a two (and a half) pass process; I render from the light position into an FBO with 4 textures attached as MRT’s each of which contains 4 layers of my opacity map.
The next pass projects the opacity map onto the object in question and a shader calculates the correct shadow value, etcetc. A third “pass” renders a quad into each of the opacity map textures to reset them (as the first pass additively blends into them)

So that’s the background. My problem is when I only want to apply this set of passes to one object in a scene, and leave another rendered using the fixed pipeline. The problem being that at the moment, the object without this shader is getting drawn entirely black, despite calls to glUseProgram(0) and various other state changes.

I altered my reset pass to clear the opacity maps to some color (red) and lo and behold rather than a black object I now have a red one. I.e it looks like I’m texturing the object using one of the opacity map textures. However, under examination with a debugger I can see that GL_TEXTURE_2D is FALSE.

A comparison of a state variable dump shows the only difference between an “ok” render when the opacity map shader isn’t applied and the red/black/textured render is that there is a value in GL_TEXTURE_BINDING in the “red” render. I didn’t think this could affect anything if GL_TEXTURE_2D was false though…?

Can anyone offer a possible explanation?

…realises that he needs to call gldisable(GL_TEXTURE_2D) on each texture unit…doh!