Results 1 to 8 of 8

Thread: Selection in Orthographic mode

  1. #1
    Junior Member Newbie
    Join Date
    Dec 2002
    Location
    England
    Posts
    4

    Selection in Orthographic mode

    Hiya,
    I have selection working in perspective mode, using the gluPickMatrix() function to generate the pick matrix. The relevant code is:

    gluPickMatrix(x, viewport[3] - y, 2,2,viewport);
    float aspect = static_cast<float>(width()) / static_cast<float>(height());
    gluPerspective(45.0, aspect, 1.0, 100.0);

    But what is the equivilent for Orthographic projections? With what do I replace gluPickMatrix()?

    Thanks for the help!

  2. #2
    Halcyon
    Guest

    Re: Selection in Orthographic mode

    Hey i don't now much about selection. And i'm not sure if this is exactly what you are looking for but i hear the functions glProject and glUnproject getting thrown around a lot for selection.

  3. #3
    Junior Member Newbie
    Join Date
    Dec 2002
    Location
    England
    Posts
    4

    Re: Selection in Orthographic mode

    They can be used for selection, but OpenGL also has a specific render mode for selection where it records which primatives end up in a specific area, which is what i'm trying to use. Anyone have any other ideas? Otherwise i might have to use glProject/unProject.

  4. #4
    Member Contributor
    Join Date
    Feb 2002
    Posts
    96

    Re: Selection in Orthographic mode

    Ortho is 2D. Can't u just use the mouse position?

  5. #5
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: Selection in Orthographic mode

    Orthographic projection is as much 3D as perspective projection. It just lacks perspective.

    Selection with orthographic projection should not be any different from selection in perspective projection. It should be enough to replace gluPerspective with glOrtho instead. The selection mechanism in OpenGL is independent of type of projection.

  6. #6
    Junior Member Newbie
    Join Date
    Dec 2002
    Location
    England
    Posts
    4

    Re: Selection in Orthographic mode

    Solved!

    Yes it is the same, gluPickMatrix can be used in glOrtho mode. I was thrown by documentation refering to it defineing a 'frustrum' which I figured would be specific to 3D.

    The problem was elsewhere, and it now works. Thanks guys!

  7. #7
    Guest

    Re: Selection in Orthographic mode

    Originally posted by Bob:
    Orthographic projection is as much 3D as perspective projection. It just lacks perspective.
    3D - perspective = 2D Right?
    Or are you talking about how the driver/card handels it; sending it through the same pipeline?

  8. #8
    Senior Member OpenGL Guru
    Join Date
    Feb 2000
    Location
    Sweden
    Posts
    2,978

    Re: Selection in Orthographic mode

    With an orthographic projection matrix, you can still use the depth buffer to eliminate hidden objects, objects too far away are still clipped by the far clip plane, fogging will still fog the objects based on distance from the viewpoint, and so on. All objects have a depth, apart from left/right and up/down; three dimensions are present.

    Orthographic projection are usually used to do 2D drawings, but that doesn't make orthographic projection itself 2D.

Similar Threads

  1. Selection mode
    By Lindley in forum OpenGL: Advanced Coding
    Replies: 6
    Last Post: 01-29-2008, 03:23 PM
  2. Selection in wireframe mode
    By devdept in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 12-19-2006, 04:22 AM
  3. Selection Mode is slooooow!
    By redarrow in forum OpenGL: Advanced Coding
    Replies: 0
    Last Post: 04-02-2005, 01:37 AM
  4. Performance drop in orthographic mode
    By DonDagan in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 09-21-2004, 07:41 PM
  5. selection mode
    By guest in forum OpenGL: Basic Coding
    Replies: 5
    Last Post: 12-02-2003, 02:23 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