Hi to all!

Suppose that you have a point (x,y,z) in object coordinates.

Opengl trasform it in the usual, using the modelview matrix, the projection matrix and finally mapping it to a screen pixel.

Suppose that the coordinates of this pixel are (xs, ys).

Now, i want to get the original object coordinates of the pixel (that is, i want (x,y,z)).

Is there a way to do this (using gluUnProject or another method)???

Ps.

I ask this cause not always i will have the (x,y,z), but i need to recover the original object coordinates using only (xs,ys)…

Pss.

I want to say more. I have a quad textured and rendered on screen after having rotated and translated it. Suppose that i select a pixel from the frame buffer of coordinates (xs,ys). This pixel could be the location of a corner of the texture, computed using a corner detection algorithm. Now, i want the coordinates of this corner in object space. In this way, i can compute the coordinates of the (frame buffer) pixel relative to the original texture…