Get zbuffer in Processing v2b6
in
Core Library Questions
•
10 months ago
Hi,
I am trying to access the zbuffer of a Scene in Processing 2b6.
The idea is to port this project to processing v2.
It seems that the object
I am trying to access the zbuffer of a Scene in Processing 2b6.
The idea is to port this project to processing v2.
It seems that the object
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!
1