Some things:
First of all, you forgot glClear. You have to call it in order for the quad to be visible. So your code should look like this:
1 2 3 4 5 6 7 8 9 10 11 12
| while (!Display.isCloseRequested()) { glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); render(); Display.update(); Display.sync(60); if (Keyboard.isKeyDown(Keyboard.KEY_ESCAPE)) { System.exit(0); } } |
The second thing; The coordinates of your quad were pretty weird, especially the z-coords:
1 2 3 4
| glVertex3f(0.0f, 1.0f, 0.0f); glVertex3f(0.0f, 1.0f, -1.0f); glVertex3f(1.0f, 1.0f, -1.0f); glVertex3f(1.0f, 1.0f, 0.0f); |
I think you missunderstood something here. The function's parameters are like following:
glVertex3f(x, y, z);
The z-axis is in your case the depth of the whole scene. The way you specified the z-coords would mean that your quad had some weird rotation. Also, some coordinates have the same x and y coordiantes which doesn't really make sense in this case. I changed the coordinates a little bit so that the quad gets displayed:
1 2 3 4 5 6
| glBegin(GL_QUADS); glVertex3f(-1.0f, 1.0f, -5.0f); glVertex3f(1.0f, 1.0f, -5.0f); glVertex3f(1.0f, -1.0f, -5.0f); glVertex3f(-1.0f, -1.0f, -5.0f); glEnd(); |
The third thing; You don't seem to be really familiar with the OpenGL coordinate system or other basic stuff. You better stick to 2D rendering for a little bit longer to gain more knowledge.
The fourth thing; Immediate mode is wicked (yes, wicked)! It appeared in the first OpenGL version (if I'm right) which was released around 1992. I think it should be quite obvious that it is by now totally deprecated. In newer OpenGL versions these functions don't even exist anymore. You should better skip Immediate-Mode rendering and start with more modern techniques like using VAOs & VBOs or whatever.
Edit: This post should help you:
http://www.java-gaming.org/topics/hello/24411/msg/205121/view.html#msg205121