5

How to turn off multiple texture units because they influence to other render parts. I activate my them:

        glActiveTexture(GL_TEXTURE0 + index);
        glBindTexture(GL_TEXTURE_2D,
               ((MaterialSampler2D)specular).texture.getTOB());
        shader.setTexture2(index);

Is there something like glDeactivateTexture?

itun
  • 3,439
  • 12
  • 51
  • 75

2 Answers2

11

glActiveTexture does not activate texture-units. It merely selects which texture-unit you're currently modifying (yes, OpenGL's object state managing is horrible). You activate textures with glEnable(<texture-target>) and glDisable(<texture-target>). In your case, the target would be GL_TEXTURE_2D.

So to answer your question: Select the texture-unit i by using glActiveTexture(GL_TEXTURE0+i) and then disable it with glDisable(GL_TEXTURE_2D).

Note that all this is redundant with shaders - you can just not access the values there.

ltjax
  • 15,837
  • 3
  • 39
  • 62
  • 2
    I use shader and I don`t need to use glEnable/glDisable(GL_TEXTURE_2D), do I? And I use this, it does not help me. – itun Apr 18 '11 at 16:40
  • Exactly, except for some dodgy drivers that are buggy (and I think there was a bug that affected this issue on ATI drivers at one time) – ltjax Apr 18 '11 at 18:50
1

You mean something like glDisable? http://www.opengl.org/sdk/docs/man/xhtml/glEnable.xml

Bart
  • 19,692
  • 7
  • 68
  • 77
  • What argument value do you think help me? – itun Apr 18 '11 at 15:56
  • from the top of my head something like glActiveTexture(GL_TEXTURE0); glDisable(GL_TEXTURE_2D); Not sure if this is what you intend to do? – Bart Apr 18 '11 at 16:04