LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: CuppoJava on May 03, 2006, 16:16:56

Title: what's the performance of glBindTexture?
Post by: CuppoJava on May 03, 2006, 16:16:56
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
Title: what's the performance of glBindTexture?
Post by: princec on May 03, 2006, 17:34:17
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 :)
Title: what's the performance of glBindTexture?
Post by: CuppoJava on May 03, 2006, 17:50:11
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?
Title: what's the performance of glBindTexture?
Post by: princec on May 03, 2006, 18:29:50
Of course - if you unnecessarily keep swapping textures you take a massive performance hit.

Cas :)