Re: Find position in 3D model from position on 2D screen
Posted by nabo on
URL: https://forum.jogamp.org/Find-position-in-3D-model-from-position-on-2D-screen-tp4025324p4025328.html
Thank you. That's exactly, what i was looking for.
But it does not yet work for me.
It only returns any hits at all, if i use a picking volume of 500x500 in gluPickMatrix (in an 1006x560 viewport).
Code is more or less copy and paste from the tutorial you posted with two differences:
Since BufferUtil does not work anymore, i replaced it with newDirectIntBuffer
selectBuffer = GLBuffers.newDirectIntBuffer(BUFSIZE);
// selectBuffer = BufferUtil.newIntBuffer(BUFSIZE);
And i added an additional argument to glGetIntegerv since i demanded one:
gl2.glGetIntegerv(GL2.GL_VIEWPORT, viewport, 0);
// gl2.glGetIntegerv(GL2.GL_VIEWPORT, viewport);
Could this be a my problem?