project/unproject with glOrtho vs perspective.

Hello,

I’ve written an application where i find the closest vertex to the mouse pointer on the 3d model. I currently use glOrtho and everything works perfectly. When i switch to using perspective view and gluLookAt the vertex selection doesnt work.

Is there a difference between the way the matices should be handled when using perspective vs ortho?

Thank you.

you must use the same matrices when picking as when rendering…

I do, thats what i find strange that it doesnt work. What else can cause my picking to fail when in perspective?

I solved my problem. It was a silly mistake, instead of unprojecting to the near and far plane of the frustum i unprojected to z = 0 , z = 1. Which works fine in glOrtho.

Thanks again.

hi mario,

if there is no secret data / flow in your code, can you share your application with me / us.

i would like to go over your code , to gain experience ?

Thank you

Hi
Even i experience the same problem.
I thought the problem was with the z-value passed to the gluunproject.
Can you tell me what is to be done after getting both the vertices in near plane and far plane.

I mean we need just one unprojected vertex right? Are we supposed to find a mean between the vertices of near and far plane ?