Hiya,
Which is faster? I think the 2nd one would be, but my FPS doesn't show much difference.
//Draw players
glLoadIdentity();
glBegin(GL_QUADS);
//player 1
glTexCoord2f(ent1->GetImage().left, ent1->GetImage().bottom); glVertex2f((float)(p1_x * TILE_SIZE), (float)(p1_y * TILE_SIZE)); // Bottom Left Of The Texture and Quad
glTexCoord2f(ent1->GetImage().right, ent1->GetImage().bottom); glVertex2f((float)(p1_x * TILE_SIZE + TILE_SIZE), (float)(p1_y * TILE_SIZE)); // Bottom Right Of The Texture and Quad
glTexCoord2f(ent1->GetImage().right, ent1->GetImage().top); glVertex2f((float)(p1_x * TILE_SIZE + TILE_SIZE), (float)(p1_y * TILE_SIZE - TILE_SIZE)); // Top Right Of The Texture and Quad
glTexCoord2f(ent1->GetImage().left, ent1->GetImage().top); glVertex2f((float)(p1_x * TILE_SIZE), (float)(p1_y * TILE_SIZE - TILE_SIZE)); // Top left of the texture and quad
//player 2
glTexCoord2f(ent2->GetImage().left, ent2->GetImage().bottom); glVertex2f((float)(p2_x * TILE_SIZE), (float)(p2_y * TILE_SIZE)); // Bottom Left Of The Texture and Quad
glTexCoord2f(ent2->GetImage().right, ent2->GetImage().bottom); glVertex2f((float)(p2_x * TILE_SIZE + TILE_SIZE), (float)(p2_y * TILE_SIZE)); // Bottom Right Of The Texture and Quad
glTexCoord2f(ent2->GetImage().right, ent2->GetImage().top); glVertex2f((float)(p2_x * TILE_SIZE + TILE_SIZE), (float)(p2_y * TILE_SIZE - TILE_SIZE)); // Top Right Of The Texture and Quad
glTexCoord2f(ent2->GetImage().left, ent2->GetImage().top); glVertex2f((float)(p2_x * TILE_SIZE), (float)(p2_y * TILE_SIZE - TILE_SIZE)); // Top left of the texture and quad
glEnd();
OR
//Draw players
Sprite ent1Spr = ent1->GetImage();
Sprite ent2Spr = ent2->GetImage();
glLoadIdentity();
glBegin(GL_QUADS);
//player 1
glTexCoord2f(ent1Spr.left, ent1Spr.bottom); glVertex2f((float)(p1_x * TILE_SIZE), (float)(p1_y * TILE_SIZE)); // Bottom Left Of The Texture and Quad
glTexCoord2f(ent1Spr.right, ent1Spr.bottom); glVertex2f((float)(p1_x * TILE_SIZE + TILE_SIZE), (float)(p1_y * TILE_SIZE)); // Bottom Right Of The Texture and Quad
glTexCoord2f(ent1Spr.right, ent1Spr.top); glVertex2f((float)(p1_x * TILE_SIZE + TILE_SIZE), (float)(p1_y * TILE_SIZE - TILE_SIZE)); // Top Right Of The Texture and Quad
glTexCoord2f(ent1Spr.left, ent1Spr.top); glVertex2f((float)(p1_x * TILE_SIZE), (float)(p1_y * TILE_SIZE - TILE_SIZE)); // Top left of the texture and quad
//player 2
glTexCoord2f(ent2Spr.left, ent2Spr.bottom); glVertex2f((float)(p2_x * TILE_SIZE), (float)(p2_y * TILE_SIZE)); // Bottom Left Of The Texture and Quad
glTexCoord2f(ent2Spr.right, ent2Spr.bottom); glVertex2f((float)(p2_x * TILE_SIZE + TILE_SIZE), (float)(p2_y * TILE_SIZE)); // Bottom Right Of The Texture and Quad
glTexCoord2f(ent2Spr.right, ent2Spr.top); glVertex2f((float)(p2_x * TILE_SIZE + TILE_SIZE), (float)(p2_y * TILE_SIZE - TILE_SIZE)); // Top Right Of The Texture and Quad
glTexCoord2f(ent2Spr.left, ent2Spr.top); glVertex2f((float)(p2_x * TILE_SIZE), (float)(p2_y * TILE_SIZE - TILE_SIZE)); // Top left of the texture and quad
glEnd();