   Question of efficiency - binding textures
  Sorry for the very terse post, but it's a simple question with a (hopefully) simple answer that is not easily found with a search engine.  If one were to do something like this:unsigned int id;glGenTextures(1, &id;// load a texture hereglBindTexture(GL_TEXTURE_2D, id);glBindTexture(GL_TEXTURE_2D, id);glBindTexture(GL_TEXTURE_2D, id);glBindTexture(GL_TEXTURE_2D, id);glBindTexture(GL_TEXTURE_2D, id);glBindTexture(GL_TEXTURE_2D, id);glBindTexture(GL_TEXTURE_2D, id);Would this cost much more than binding the texture once, or will OpenGL immediately recognize this repeat and act accordingly?  If it will needlessly complicate my graphics engine I don't want to separate binding and drawing (in the event of using the same tex to draw many things) but if it's a large matter of efficiency, it'll have to be so.Thanks.   
  The most efficient way to do that, is do the following:unsigned int *id[numTextures];glBindTexture(....,id[0] );glBindTexture(....,id[1]);...and put that code in your Init method. then at any given time you can access any one of those textures.   ;Quote:Original post by FrequencyWould this cost much more than binding the texture once, or will OpenGL immediately recognize this repeat and act accordingly?  Depends on the driver, the spec doesn't mandate it at all.Your best bet when rendering is to sort by texture anyways (well, after any shaders), as such you shouldn't need to rebind like that;Quote:Original post by phantomDepends on the driver, the spec doesn't mandate it at all.Your best bet when rendering is to sort by texture anyways (well, after any shaders), as such you shouldn't need to rebind like thatHMMM I'm guessing I do my rendering a lot differently and a lot worse than you do.  When an object request a texture be drawn, say a textured rectangle, the Graphics object just does it on the spot and it's revealed when I swap buffers (using SDL).  Is the recommended way to do rendering having the Graphics object keep a laundry list (of things that need to be rendered, where, and how) and do it in a rendering phase at the end of the game loop?EDIT: Oh, and I'll probably just put myself in a situation where I'll be rebinding textures right now and see if it's enough of a performance hit to worry about it.  Thanks for the heads up.   ;static int  boundtexes[numtextureunits];if(id != boundtexes[layerid]){/*take case of the active layer*///bind textureglBindTexture(GL_TEXTURE_2D,id);}