Processing Forum
FloatBuffer hasn't got the array
zbuffer anymore.
So I tried with the commented code that tries to acces the zbuffer using OpenGL:
PGraphicsOpenGL pogl = (PGraphicsOpenGL) g;
FloatBuffer zbuff = FloatBuffer.allocate(1);
pogl.gl.glReadPixels( mouseX, mouseY, 1, 1, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, zbuff);
float z = zbuff.get();
At first I had some issues with the 5fth parameter GL.GL_DEPTH_COMPONENT, but by switching it to GL2.GL_DEPTH_COMPONENT I solved that first obstacle.
But now I am receiving z = 1 for every mouse position.
Any ideas?
Thanks!