what's the performance of glBindTexture?

Started by CuppoJava, May 03, 2006, 16:16:56

Previous topic - Next topic

CuppoJava

Hi, just a small question:
I find that in my program I'm often making redundant calls to glBindTexture. eg. I'm rebinding the same texture.

Is this acceptable, or should i check whether a texture is already bound and only bind it if it is not already bound?

Thx
 -Cuppo

princec

Generally you should keep track and only call it if you have to. Although I suspect modern drivers do this for you. I generally don't check, myself, but that's because I've already sorted everything in order of texture id anyway and only call it once by design.

Cas :)

CuppoJava

Thanks for the reply Cas,
Sorting your draw routine by texture id is pretty smart. Do you find that the extra sorting and bookkeeping overhead is worth it to eliminate redundant binding?

princec

Of course - if you unnecessarily keep swapping textures you take a massive performance hit.

Cas :)