Hmmm....I'm thinking, after all this, its not what I need anyhow, for the
third parameter to gluUnProject(). Sorry to give everyone the runaround. I
thought I needed an actual Z value. My problem must reside elsewhere -- and
I was surethis was it.
BTW, do you need this function yourself? I'll be glad to look t it and put
it into code for the group if anyone really needs it. -Ralph
> > > > I have a zNear value of 5.0, and a zFar value of 60.0.
> > > > When I click on an object in my scene, and call:
> > > > glReadPixels(x,y,1,1,GL_DEPTH_COMPONENT,GL_FLOAT,&selectedThingZ);
> > > > I get a value of 0.95 for my selectedThingZ.
> > > > What, actually, is that z value given my zNear and zFar (I have
loked at the
> > > > FAQ, but find nothing on this). Also, what would happen in
> > > The redbook fig. 3-18 shows that depth coord values are in the
range of 0->1 and not linear.
> > > I'm no mathematician, if I'm not mistaken the z-buffer value is a
number representing the non-linear location in zNear-zFar
Quote:> > > space, so I would guess, that .95 squared of the z range + the znear
is the actual worldspace location, i.e.:
> > > znear+pow(.95,2)*(zfar-znear)
> > > 5 + .9025 *( 60 - 5 ) or 54.6375?
> > > pow may not be the precise way to convert the z value but it looks
> > The exact maths for doing this are described at the OpenGL SIGGRAPH
> > courses:
> Like I said, I'm no mathematician.
> I can't get a resaonable value, can you/someone compute the example