OpenGL:关闭多个纹理单元
如何关闭多个纹理单元,因为它们会影响其他渲染部分。 我激活我的它们:
glActiveTexture(GL_TEXTURE0 + index);
glBindTexture(GL_TEXTURE_2D,
((MaterialSampler2D)specular).texture.getTOB());
shader.setTexture2(index);
有类似 glDeactivateTexture 的东西吗?
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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
glActiveTexture
不激活纹理单元。它只是选择当前正在修改的纹理单元(是的,OpenGL 的对象状态管理很糟糕)。您可以使用
glEnable()
和glDisable()
激活纹理。在您的情况下,目标将为GL_TEXTURE_2D
。因此,回答您的问题:使用
glActiveTexture(GL_TEXTURE0+i)
选择纹理单元i
,然后使用glDisable(GL_TEXTURE_2D)
禁用它。请注意,所有这些对于着色器来说都是多余的 - 您只是无法访问那里的值。
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>)
andglDisable(<texture-target>)
. In your case, the target would beGL_TEXTURE_2D
.So to answer your question: Select the texture-unit
i
by usingglActiveTexture(GL_TEXTURE0+i)
and then disable it withglDisable(GL_TEXTURE_2D)
.Note that all this is redundant with shaders - you can just not access the values there.
你的意思是像glDisable这样的东西? http://www.opengl.org/sdk/docs/man/xhtml /glEnable.xml
You mean something like glDisable? http://www.opengl.org/sdk/docs/man/xhtml/glEnable.xml