Paul Surgeon writes:
> 
> On Thursday, 4 November 2004 22:02, Aaron Wilson
> wrote:
> > Paul,
> >          NeHe has a good example of how to convert
> the screen coordinates
> > into OpenGL coordinates.
> >
> http://nehe.gamedev.net/data/articles/article.asp?article=13
> >
> > 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
> cursor)?
> 
> 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 :-)

http://prettypoly.sourceforge.net/

Norman

_______________________________________________
Flightgear-devel mailing list
[EMAIL PROTECTED]
http://mail.flightgear.org/mailman/listinfo/flightgear-devel
2f585eeea02e2c79d7b1d8c4963bae2d

Reply via email to