reading depth buffer returns only 0

Started by Jens v.P., December 17, 2007, 17:11:13

Previous topic - Next topic

Jens v.P.

Hi,

I'm trying to read the depth buffer, but it isn't working -- the result contains only 0 floats.
This is my code (abridged):

// init
final GLData data = new GLData();
data.doubleBuffer = true;
data.depthSize = 1; // Add this line to force a depth buffer
final GLCanvas canvas = new Draw3DCanvas(i_composite, SWT.NONE, data);
GL11.glEnable(GL11.GL_DEPTH_TEST);
GL11.glDepthRange(0.0, 1.0);
// later on
.. render some stuff ..
.. create buffer .. actualBufferSize contains the size of the screen (with unpack alignment)
GL11.glReadPixels(0, 0, actualBufferSize.width, actualBufferSize.height,
        GL11.GL_DEPTH_COMPONENT,
        GL11.GL_FLOAT, bufferDepth);
		
getCanvas().swapBuffers();


I'm also reading the color buffer the very same way, and it is working. What am I doing wrong, here?
Is it my system (MacBook Pro with Leopard)?

Fool Running

Are you using JOGL and LWJGL at the same time? I'm surprised that works at all. How are you able to use LWJGL without creating a display?
Programmers will, one day, rule the world... and the world won't notice until its too late.Just testing the marquee option ;D

Jens v.P.

I'm using LWJGL with Eclipse. The canvas is an org.eclipse.swt.opengl.GLCanvas. A small example can be found at
http://www.eclipse.org/swt/opengl/ (Snippet 195).