I ported working code from lwjgl version .8 to .9 (windows) and now it looks like I can't enable depth testing. My init code:
GL11.glClearDepth(1.0f);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthFunc(GL11.GL_LEQUAL);
in .8 correctly rendered two cubes intersecting. Now in .9 the same code shows one cube on top of the other.
I checked the bit depth of the window.create() as per the "Depth buffer" thread from July 27 but changing the bit depth has no effect.
What am I missing here?
Full code is at http://potatoland.com/code/lwjgl/lwjgl_test_v9/GLApp.java
initOpenGL() sets up depth test etc.
render() draws the cubes
The problem is this line:
Window.create(windowTitle, bitsPerPixel, 0, 0, 0);
The bitsPerPixel is only determining the precision of the frame buffer colors, not the depth buffer. Try
Window.create(windowTitle, bitsPerPixel, 0, 16, 0);
Which is asking for (at least) 16 bit depth buffer.
- elias
Okay, that works. Thanks elias.