Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 19 Mar 2012
Offline Last Active Aug 05 2012 08:32 AM

Posts I've Made

In Topic: is glBindTexture() not efficency ?

19 March 2012 - 06:12 AM

Thank you very much !Posted Image

glBindTexture will likely cause a pipeline stall at the next draw call. Insofar, glBindTexture is not inefficient itself, but using it too often is. I say "likely" because it is possible that it does not cause a stall, depending on the hardware (but you have to assume the worst case, not the best case).

On the other hand, glBegin/glEnd is not efficient for drawing thousands of tiles (i.e. single quads) either.

What you want to do ideally is bind a texture once, bind a vertex buffer, and draw your 2000 quads with one call to glDrawElements. Even using a plain old vertex array (i.e. not a buffer object) would be much preferrable, because it's much more efficient for the GL to upload that block of data.