Jump to content
Posted 19 March 2012 - 05:19 AM
Posted 19 March 2012 - 05:34 AM
Posted 19 March 2012 - 06:12 AM
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.