Sign in to follow this  

quick glBindTexture question

This topic is 4381 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

//will 
glBindTexture(GL_TEXTURE_2D,texture);
//not take as long if the selected texture is already binded or should i just

Gluint CurrentTexture=0;

void bind(Gluint texture){
 if (texture!=CurrentTexture){
  glBindTexture(GL_TEXTURE_2D,texture);
  CurrentTexture=texture;
 }
}

Share this post


Link to post
Share on other sites
That is entirely dependant on the implementation that you are using. I assume that any reasonable implementation would not re-bind a texture that is already bound (so the performance hit shouldn't be much more than the function call overhead).

Share this post


Link to post
Share on other sites
I used to do that too. Until i did a performance-check. On the hardware i was using at that time it didn't matter at all.
I assume common implementations check the currently bound texture before binding anyway. So the client-application is not required to perform this check.
But I may be wrong and not checking might slow down some machines. Then again chances that you exidentially bind the same texture twice in a row is really low.

Share this post


Link to post
Share on other sites
its slower on all hardware, u most likely didnt see a difference cause both take very little time eg perhaps 0.0000001 secs thus its hard to tell the differences

Share this post


Link to post
Share on other sites

This topic is 4381 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this