View Full Version : project/unproject with glOrtho vs perspective.
12-06-2009, 09:19 AM
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?
12-06-2009, 02:34 PM
you must use the same matrices when picking as when rendering..
12-07-2009, 12:18 AM
I do, thats what i find strange that it doesnt work. What else can cause my picking to fail when in perspective?
12-07-2009, 04:54 AM
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.
12-08-2009, 12:53 AM
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 ?
12-08-2009, 02:52 AM
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 ?
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.