Problem with glReadPixels() on OS X retina display
Posted by martinezmj on
URL: https://forum.jogamp.org/Problem-with-glReadPixels-on-OS-X-retina-display-tp4033426.html
I am using this line of code as part of a surface "picking" method. It all works except in one case, OS X using JRE 7 on a retina display:
gl.glReadPixels((int) winX, (int) winY, 1, 1, GL2ES2.GL_DEPTH_COMPONENT, GL.GL_FLOAT, winZ);
Here is a platform breakdown in OS X:
JRE 6 Non-retina = works
JRE 7 Non-retina = works
JRE 6 retina = works
JRE 7 retina = fails
When it fails, it just returns the wrong value in winZ, as if the picking is not intersecting a surface. The bottom-right quadrant of the projection view returns real data in winZ (although it's not accurate). The rest of the view just returns 1 (which is what it does when the pick does not intersect with anything).
I've tried things like multiplying winX and winY by 2, but haven't been able to get around this issue. This obviously has something to do with the pixel doubling of the retina display. Are there any JOGL settings I can use to toggle this behavior on/off? Or is there anything I'm missing?
I am testing using JOGL 2.2.4 in OS X 10.9.5.