you can't use glEnable glDisable TEXTURE_2D to force a glsl shader to use or no texture mapping
glEnable glDisable has no effect if the state you want to enable or disable is concerned by the vertex or fragment stage(like textures, lights, fog ...)however some other state like DEPTH_TEST is not concerned by the fragment vertex stage (see the gl specs for more informations)
there's many solution for this:
write another shader for geometri that doesn't use textures
or use a uniform variable as a boolean(int 0 or 1) to tell the shader
if it's using or not textures
原来那个人提的问题是:
Hello people, I'm using shaders(glsl) in my opengl program (C++) and I'm using it for texture mapping. My question is how can I disable the shaders for some geometries and apply shaders to some other, like glDisable(GL_TEXTURE_2D) in opengl, I tried it but it doesn't work. Many tnx in advance
https://www.gamedev.net/forums/topic/452364-how-to-disable-texture-in-glsl/
其他链接:
https://gamedev.stackexchange.com/questions/62457/why-would-one-bind-several-textures-to-the-same-opengl-texture-unit