Original Post
Hello there. To start.. I am relatively green at GL programming. I've tried to find info on this, but nothing to address this particular problem. Knowing this, be gentle :D On to the issue. I am writing a 2D game in allegrogl. (The problem lies with the GL side of things. If this is in the wrong forum, please accept my apologies) Anyway, here is my drawing code; ----------------------------------------------------- void RSMAP::Draw(const float scale) { float zvalue = -2.0; int lx, ly; glEnable(GL_TEXTURE_2D); if (scale ==0) {allegro_message("Warning! Map scale is zero!");} for (ly=0;ly<=MAPW;ly++) { for (lx=0;lx<=MAPH;lx++) { glBindTexture(GL_TEXTURE_2D, Tile[lx][ly].texture); glBegin(GL_QUADS); glColor3f(1.0, 1.0, 1.0); glTexCoord2f( 0, 0); glVertex3f(lx , ly , zvalue); glTexCoord2f( 1, 0); glVertex3f(lx +scale, ly , zvalue); glTexCoord2f( 1, 1); glVertex3f(lx +scale, ly +scale, zvalue); glTexCoord2f( 0, 1); glVertex3f(lx , ly +scale, zvalue); glEnd(); } } } --------------------------------------------------------------------- Now, I'm aware scale doesn't do what it implies. I took out the "proper" code in lieu of debugging. Scale is always 1 for now. The texture loads properly and all that jazz. Anyway, to further explain the problem. The code as it is, is SLOW. 15fps slow. I've determined it's because of the calls to glbegin/end. If I move glbegin/end to the outside of the nested loops, it gets a good 15fps boost, however bind texture doesn't work inside glbegin/end as you all probably know. I may be wrong and it may be all those calls to glbindtexture, but I digress. Every tile has it's own GLuint Texture; inside of Tile[x][y]. MAPW/MAPH are defines (currently 100x100). The question is.. am I approaching this properly.. and if so.. how are you supposed to set each tile's texture? Thanks. Arith