Ternary
06-12-2007, 03:49 PM
I'm trying to get a very accurate world coordinate for a point the user clicks on. I start with the classic calls to glReadPixels and gluUnProject. This method gives me a reasonable world coordinate with a bit of error as expected.
In order to get a more accurate point I though I would then move the near and far clip planes to either side of the point of interest and redraw the scene. This forces all the depth buffer precision in the small area of interest.
I then call glReadPixels and gluUnProject a second time and expect a much more accurate point, but instead I get a world coordinate which is nearly (within 0.01%) the same as with the original method.
Is there a flaw in my understanding of how depth buffer precision works? Is my method invalid?
Thanks for any enlightenment.
In order to get a more accurate point I though I would then move the near and far clip planes to either side of the point of interest and redraw the scene. This forces all the depth buffer precision in the small area of interest.
I then call glReadPixels and gluUnProject a second time and expect a much more accurate point, but instead I get a world coordinate which is nearly (within 0.01%) the same as with the original method.
Is there a flaw in my understanding of how depth buffer precision works? Is my method invalid?
Thanks for any enlightenment.