Advertisement

binding the same texture

Started by
2 comments, last by dawidjoubert 18 years, 11 months ago
I know that binding a texture (glBindTexture) is a somewhat expensive operation My question is, if there is subsequent calls of glBindTexture with the same texture (same id, not just the image), is OpenGL clever enough not to rebind it? Or should I check myself to avoid reduntancy?
It's douptfull that opengl is that clever, it's because of this you should try and restrict yourself a little when doing these things.
Render things on a per material basis not on a per object basis.
only use glBindTexture when you absolutly need to.

Allso it's not only rebinding a texture that causes a new so called renderstate.
Pretty mutch anything that transforms the outputform(stencils, blendfuncs, masks and so on) causes it, except for matrix transformations, colors and the like since those are done in the DIP part of an batch.

note: a batch consists of a renderstate folowed by a DrawIndexedPrimitive(lot's of triangles) call.
You can have about "25000*CPU GHz*rendering efficiency Percent/framrate" batches per frame.
At 30 fps on a 2 GHz computer where 20 percent is used for graphics you get 333 batches per frame.
Allthough that looks like it's a high number, you'll spend them faster than you can say WTF!

[Edited by - lc_overlord on September 27, 2005 6:25:49 AM]
Advertisement
I thought so and I was ready to reorganize everything so models with the same texture be drawn together
but if opengl could understand that the same texture is binded, that could save a LOT of time.....
pity,
thank you anyway
Quote: Original post by eXXXile
I thought so and I was ready to reorganize everything so models with the same texture be drawn together
but if opengl could understand that the same texture is binded, that could save a LOT of time.....
pity,
thank you anyway


Alot of stuff in the coding world is that way (or atleast could save us some trouble) but then if ogl did do a check those of us who managed it correctly for example would be wasting CPU time again instead of GPU (not really sure where everything is done) so in the end they decide call it a convention and thats final...
----------------------------

http://djoubert.co.uk

This topic is closed to new replies.

Advertisement