开发者

OpenGL: Turn off multiple texture units

开发者 https://www.devze.com 2023-02-27 07:50 出处:网络
How to turn off multiple texture units because they influence to other render parts. I activate my them:

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 glDeactivateTextur开发者_如何学Ce?


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.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号