I have been spending my spare time porting my old code to jsr231, most everything is going smooth, I am just having trouble getting exact 3D mouse coordinates with the new api.
With 1.0, I would call glReadPixels and get my z value, load that into gluUnproject, and have exact coordinates
I have tried two different jdk’s, several cvs versions of jsr231, and the dri hack on a recent post. They all return values that are too small. I have used BigDecimal to get some readable output, and the value returned are roughly “0.00001”. On manual z entry into gluUnproject, “z=0.4” and up to “z=0.9”, give perfect x,y,z coordinates when I find that spot in the scene with my mouse.
I am using the glReadPixels function that takes a buffer for an argument. Currently I am using a DoubleBuffer, I have also tried using a ByteBuffer at one point or another, which caused the value to vary without much logic. I have also updated my ModelView, etc, to buffers instead of arrays.
I am sure it is the z value retured by glReadPixels that is the problem, because I can manually enter it into gluUnproject and get reasonable results back (of couse, only where the z value is correct with the manual setting).
Thanks
Greg