java method

Java code posted by kulpae
created at 12 Aug 00:41, updated at 12 Aug 00:41

Edit | Back
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
public class SomeClass {
    public void render() {
        float x, y, z;
        GL11.glBegin(GL11.GL_QUADS);
        for (int i = 0; i < height; i++) {
            for (int j = 0; j < width; j++) {
                x = j * tilew;
                y = getHeight(j, i);
                z = i * tileh;
                setColor(y);
                GL11.glVertex3f(x, y, z);
                x += tilew;
                y = getHeight(j + 1, i);
                setColor(y);
                GL11.glVertex3f(x, y, z);
                y = getHeight(j + 1, i + 1);
                z += tileh;
                setColor(y);
                GL11.glVertex3f(x, y, z);
                x -= tilew;
                y = getHeight(j, i + 1);
                setColor(y);
                GL11.glVertex3f(x, y, z);
            }
        }
        GL11.glEnd();
    }
}
875 Bytes in 2 ms with coderay