• Advertisement
Sign in to follow this  

glActiveTexture and glBindTexture

This topic is 1453 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I thought that a glBindTexture following a glActiveTexture would cause the texture to be binded in the texture order specified by the glActiveTexture, but according to my experiments it's not. 

 

Example:

glActiveTexture(GL_TEXTURE0);
glBindTexture(GL_TEXTURE_2D, texID);
// draw something using GL_TEXTURE0... it uses texture texID

glActiveTexture(GL_TEXTURE1);
glBindTexture(GL_TEXTURE_2D, anotherTexID);
// draw something using GL_TEXTURE0 again... it uses anotherTexID!

texID is binded to GL_TEXTURE0 ? and anotherTexID to GL_TEXTURE1? I think not, because second draw will use the second texture even if I tell to use GL_TEXURE0 (the first).

 

So it's true? glBind is not related to glActive and viceversa?

 

 

 

 

 

 

 

 

Share this post


Link to post
Share on other sites
Advertisement

This depends on what texture environment (via glTexEnv - for fixed pipeline OpenGL) or shader (for modern OpenGL) you've set.  In other words - glBindTexture does set the texture for the currently active texture unit, but this just sets the inputs for your drawing.  It's also up to you to tell OpenGL what to actually do with those inputs.

Share this post


Link to post
Share on other sites

thank for reply, I use shaders.

 

Anyway, this morning, after visual studio restart and a clean and rebuild (or maybe a night of sleep), it works as aspected, with the second call using the second texture. I hope this will never happens again! Yesterday I tried so many times! mah wacko.png

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement