[英]OpenGL: Turn off multiple texture units
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? 有像glDeactivateTexture的东西吗?
glActiveTexture
does not activate texture-units. glActiveTexture
不会激活纹理单元。 It merely selects which texture-unit you're currently modifying (yes, OpenGL's object state managing is horrible). 它只选择你当前修改的纹理单元(是的,OpenGL的对象状态管理是可怕的)。 You activate textures with
glEnable(<texture-target>)
and glDisable(<texture-target>)
. 使用
glEnable(<texture-target>)
和glDisable(<texture-target>)
激活纹理。 In your case, the target would be GL_TEXTURE_2D
. 在您的情况下,目标将是
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)
. 所以回答你的问题:使用
glActiveTexture(GL_TEXTURE0+i)
选择纹理单元i
,然后用glDisable(GL_TEXTURE_2D)
禁用它。
Note that all this is redundant with shaders - you can just not access the values there. 请注意,对于着色器,所有这些都是多余的 - 您无法访问那里的值。
You mean something like glDisable? 你的意思是像glDisable? http://www.opengl.org/sdk/docs/man/xhtml/glEnable.xml
http://www.opengl.org/sdk/docs/man/xhtml/glEnable.xml
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.