I am Using this method to draw my tiles in my LWJGL game.
public static void DrawQuad(Texture tex, float x, float y, float width, float height) {
tex.bind();
glTranslatef( x - player.x, y - player.y, 0);
glBegin(GL_QUADS);
glTexCoord2f(0, 0);
glVertex2f(0, 0);
glTexCoord2f(1, 0);
glVertex2f(width, 0);
glTexCoord2f(1, 1);
glVertex2f(width, height);
glTexCoord2f(0, 1);
glVertex2f(0, height);
glEnd();
glLoadIdentity();
}
But using glBegin everytime I draw a tile gives a lot of lag. (I draw around 645 tiles per frame).
How can I prevent using glBegin so much times?