Paul Surgeon writes:
> On Thursday, 4 November 2004 22:02, Aaron Wilson
> > Paul,
> > NeHe has a good example of how to convert
> the screen coordinates
> > into OpenGL coordinates.
> > Aaron
> I found that article very helpful.
> The part I don't understand is how the glReadPixels
> get's the winZ co-ordinate.
> I mean I'm looking at a wireframe ellipsoid from an
> odd angle - how does it know how to return the Z
> co-ordinate of the surface of the ellisoid?
> Surely I have to tell it where the surface is so that
> it knows how to intercept the surface and not try to
> pick a point into infinity (in front of and behind my
> That is what is not explained anywhere I look.
If you have enabled DepthBuffer operations in OpenGL
the rasterizing process keeps track of the depth component
of each pixel in the ZBuffer.
Note this won't work to well with wireframe and that the
Z component is the distance from the eyepoint
For an example that does this using SSG
PPE keeps track of the position for a 3d Cursor
$PPE_SRC / src / viewer / ppeViewerDraw.cxx / ppeViewer::update_3D_cursor()
Note I am quite swamped with work and won't have time
to explain the PPE code but you have the source :-)
Flightgear-devel mailing list