Quantcast
Channel: Processing Forum
Viewing all articles
Browse latest Browse all 1768

Get zbuffer in Processing v2b6

$
0
0
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 FloatBuffer hasn't got the array zbuffer anymore.
So I tried with the commented code that tries to acces the zbuffer using OpenGL:

  1. PGraphicsOpenGL pogl = (PGraphicsOpenGL) g;
  2. FloatBuffer zbuff = FloatBuffer.allocate(1);
  3. pogl.gl.glReadPixels( mouseX, mouseY, 1, 1, GL.GL_DEPTH_COMPONENT, GL.GL_FLOAT, zbuff);
  4. 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!


Viewing all articles
Browse latest Browse all 1768

Trending Articles