Heres the main loop:
float x = 0, y = 0, z = 0, pit = 0, yaw = 0;
int size = 1;
do {
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) {
Display.destroy();
System.exit(0);
}
if (Keyboard.isKeyDown(Keyboard.KEY_A)) {
x -= 0.04 * (float) Math.sin(Math.toRadians(yaw - 90));
z += 0.04 * (float) Math.cos(Math.toRadians(yaw - 90));
}
if (Keyboard.isKeyDown(Keyboard.KEY_D)) {
x -= 0.04 * (float) Math.sin(Math.toRadians(yaw + 90));
z += 0.04 * (float) Math.cos(Math.toRadians(yaw + 90));
}
if (Keyboard.isKeyDown(Keyboard.KEY_W)) {
x -= 0.04 * (float) Math.sin(Math.toRadians(yaw));
z += 0.04 * (float) Math.cos(Math.toRadians(yaw));
}
if (Keyboard.isKeyDown(Keyboard.KEY_S)) {
x += 0.04 * (float) Math.sin(Math.toRadians(yaw));
z -= 0.04 * (float) Math.cos(Math.toRadians(yaw));
}
yaw += Mouse.getDX();
pit += Mouse.getDY();
Mouse.setGrabbed(true);
glLoadIdentity();
GL11.glRotatef(pit / 3, 1.0f, 0.0f, 0.0f);
GL11.glRotatef(yaw / 3, 0.0f, 1.0f, 0.0f);
glTranslatef(x, y, z);
//Some test world data
drawCube(size, crate);
glTranslatef(0.0f, 0.0f, -2.0f);
drawCube(size, crate);
glTranslatef(0.0f, 0.0f, -2.0f);
drawCube(size, crate);
glTranslatef(0.0f, 0.0f, -2.0f);
drawCube(size, crate);
glTranslatef(0.0f, 0.0f, -2.0f);
drawCube(size, crate);
glTranslatef(0.0f, 0.0f, -2.0f);
drawCube(size, crate);
glTranslatef(0.0f, 0.0f, -2.0f);
drawCube(size, crate);
Display.update();
} while (true);



















