Results 1 to 6 of 6

Thread: project/unproject with glOrtho vs perspective.

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2009
    Posts
    6

    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.

  2. #2
    Junior Member Newbie
    Join Date
    Oct 2009
    Location
    sweden
    Posts
    8

    Re: project/unproject with glOrtho vs perspective.

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

  3. #3
    Junior Member Newbie
    Join Date
    Oct 2009
    Posts
    6

    Re: project/unproject with glOrtho vs perspective.

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

  4. #4
    Junior Member Newbie
    Join Date
    Oct 2009
    Posts
    6

    Re: project/unproject with glOrtho vs 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.

  5. #5
    Junior Member Newbie
    Join Date
    Dec 2009
    Posts
    6

    Re: project/unproject with glOrtho vs perspective.

    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

  6. #6
    Junior Member Newbie
    Join Date
    Dec 2009
    Posts
    10

    Re: project/unproject with glOrtho vs perspective.

    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 ?

Similar Threads

  1. Migrating from GLOrtho to GLU to give glRotatef perspective
    By FrankMonza in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 08-08-2014, 06:29 AM
  2. Need help with glm::project & glm::unproject
    By caaso in forum OpenGL: General
    Replies: 2
    Last Post: 05-29-2012, 07:46 PM
  3. How to choose between glOrtho/Perspective/Frustum?
    By jacksmash in forum OpenGL: Basic Coding
    Replies: 4
    Last Post: 12-11-2007, 10:28 AM
  4. Replies: 4
    Last Post: 11-02-2006, 04:26 PM
  5. Project and unProject
    By BBF in forum OpenGL: General
    Replies: 5
    Last Post: 04-06-2004, 02:44 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean