问题描述
在OpenGL中,我一直都了解glEnable(GL_TEXTURE_1D)
,glEnable(GL_TEXTURE_2D)
和/或glEnable(GL_TEXTURE_3D)
(以及相应的glDisable
)是每个纹理单元参数.
In OpenGL I have always understood that glEnable(GL_TEXTURE_1D)
, glEnable(GL_TEXTURE_2D)
and/or glEnable(GL_TEXTURE_3D)
(and corresponding glDisable
) is a per texture unit parameter.
最近,我试图确认这一点,但是没有找到任何明确的文档来确认关于此问题的任何一种方法.
Recently I tried to confirm this but have not found any clear documentation confirming either way regarding this question.
我应该这样做并简单地将其放入代码
Put simply and in code, should I be doing this
glActiveTexture(GL_TEXTURE0);
glEnable(GL_TEXTURE_2D);
... bind etc ...
glActiveTexture(GL_TEXTURE1);
glEnable(GL_TEXTURE_2D);
... bind etc ...
或此
glEnable(GL_TEXTURE_2D);
glActiveTexture(GL_TEXTURE0);
... bind etc ...
glActiveTexture(GL_TEXTURE1);
.... bind etc ...
我希望能找到一些清晰的地方.
I was hoping to find some clarity.
推荐答案
确实是每个纹理单位.我发现最近提到的明确提及此问题的文档是Open GL规范2.1(2006年更新)这里
It is indeed per texture unit. The most recent documentation I found mentioning this explicitly was the Open GL specification 2.1 (2006 update) here
在3.8.16节中:纹理应用
In section 3.8.16: Texture Application
它可能在新规范中的某处提到过,但是它们经过了重新组织.您可以在opengl org网站上查看所有Open GL版本规范(我想发布一个链接,但似乎不能发布多个链接).
It is probably mentioned somewhere in the new specifications but they were heavy re-organized. You can have a look at all the Open GL version specifications on the opengl org website (I wanted to post a link but I can't seem to post more than one).
这篇关于应该为每个纹理单位应用glEnable(GL_TEXTURE_2D)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!