LWJGL Forum

Programming => Lightweight Java Gaming Library => Topic started by: napier on August 24, 2004, 03:01:18

Title: Can't enable depth buffer in .9 ??!
Post by: napier on August 24, 2004, 03:01:18
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
Title: Can't enable depth buffer in .9 ??!
Post by: elias on August 24, 2004, 07:41:46
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
Title: Can't enable depth buffer in .9 ??!
Post by: napier on August 25, 2004, 02:30:02
Okay, that works.  Thanks elias.