I have a sphere and am looking from an arbitary position (using gluLookAt) at the surface of the sphere towards the center/origin of the sphere.
I need to transform screen co-ords into GL co-ords and gluUnProject is my answer.
However I do not understand how glReadPixels is used to return the winZ part of the screen co-ord.
How does glReadPixels know where the surface of my sphere is?
Is there some sort of depth testing going on that I need to set up first?
At the moment my viewport clipping planes surround the entire sphere so where is glReadPixels going to get the depth from?
Also it’s a wire frame sphere so a click can go “right through” the sphere?!
I don’t understand how winZ is determined - can someone please explain it to me in noob language?