PDA

View Full Version : Binding Textures



tonyo_au
11-07-2012, 07:48 PM
Is this valid


glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE2D, TextureID_01);
render
glBindTexture(GL_TEXTURE2D, TextureID_02);
render
glBindTexture(GL_TEXTURE2D, TextureID_03);
render
glBindTexture(GL_TEXTURE2D, 0);


Or do I have to unbind before I can bind a new texture?

Alfonse Reinheart
11-07-2012, 08:31 PM
Yes, it is legal to bind another object on top of an object. That unbinds the bound object and binds the other.

Also, the wiki covers this (http://www.opengl.org/wiki/OpenGL_Object#Object_Usage).

tonyo_au
11-07-2012, 11:36 PM
Thanks - I just had a lose of faith while trying to debug some code that is behaving strangely