   quick opengl question about textures
  I was wondering if there is any better to render multiple textures.glBindTexture(GL_TEXTURE_2D, Game-&gt;getTexture(texturelocation[1].c_str()));// ( CHANGE )glVertexPointer(2,GL_FLOAT,0,vertices[1]);glTexCoordPointer(2,GL_FLOAT,0,textures[1]);glDrawArrays(GL_QUADS,0,1200);glBindTexture(GL_TEXTURE_2D, Game-&gt;getTexture(texturelocation[2].c_str()));// ( CHANGE )glVertexPointer(2,GL_FLOAT,0,vertices[2]);glTexCoordPointer(2,GL_FLOAT,0,textures[2]);glDrawArrays(GL_QUADS,0,1200);glBindTexture(GL_TEXTURE_2D, Game-&gt;getTexture(texturelocation[3].c_str()));// ( CHANGE )glVertexPointer(2,GL_FLOAT,0,vertices[3]);glTexCoordPointer(2,GL_FLOAT,0,textures[3]);glDrawArrays(GL_QUADS,0,1200);Cause I want to draw three layers, each having the same or different texture but the screen coordinates should stay the same.On another note: what would be more efficient? having one giant list of all the npcs locations or just have the npc have a draw function?e.g. NpcVert[200][8];//200 instances, each with 8 points of data NpcText[200][8];or for(int loop=0;loop&lt;npcAmount;loop++){ npc.draw();}
Quote:Original post by ShadowwoelfI was wondering if there is any better to render multiple textures.*** Source Snippet Removed ***Cause I want to draw three layers, each having the same or different texture but the screen coordinates should stay the same.You can use a loop. Then you won't need to duplicate code.By the way, are you sure you want to index the arrays from 1 and not 0?Quote:On another note: what would be more efficient? having one giant list of all the npcs locations or just have the npc have a draw function?e.g. *** Source Snippet Removed ***I'm not sure what you mean. Can you elaborate a little? Maybe show some more code?;  Oh for the first example I was just doing a quick prototype but your right it should be 0.But for the second question I was simply asking what would be a better way to go about this.glBindTexture(GL_TEXTURE_2D, Game-&gt;getTexture(texturelocation[0].c_str()));// ( CHANGE )glVertexPointer(2,GL_FLOAT,0,npcvert[0]);glTexCoordPointer(2,GL_FLOAT,0,npctext[0]);glDrawArrays(GL_QUADS,0,x);  //Where x is the number of npcs *4or just have each npc class have its own draw routine.  Same thing as above except it just draws itself and nothing more.Right now I am thinking that just having the npc classes draw themselves would cause a performance hit but would be easier to maintain and program.  So what are your opinions on this?   ;Quote:Original post by ShadowwoelfRight now I am thinking that just having the npc classes draw themselves would cause a performance hit but would be easier to maintain and program.  So what are your opinions on this?I definitely agree that it would be easier to maintain and program, but why do you think it will cause a performance hit?   ;  Wouldn't it be the same as immediate mode since I am only drawing one quad instead of everything at once?   