Results 1 to 7 of 7

Thread: Mouse selection

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2000
    Location
    FRANCE
    Posts
    9

    Mouse selection

    Hi i'm french so i'm sorry for my poor english.


    is there a way to select an object with the mouse ?

    i'm using gl.h, glu.h and glaux.h but not glut.dll.


    Thierry

  2. #2
    Member Newbie
    Join Date
    Mar 2000
    Location
    UK
    Posts
    36

    Re: Mouse selection

    Yeah, there is.

    If you've got the Red book, then look up picking. If you don't have the Red book, then here's a quick intro:

    1. Call glSelectBuffer
    2. Call glRenderMode(GL_SELECT)
    3. Select the projection matrix
    4. Load identity
    5. Call gluPickMatrix
    6. Call gluPerspective (if you're using perspective)
    7. Select the modelview matrix
    8. Load identity
    9. Clear depth and colour buffers
    10. Draw scene pusing and popping names where appropriate
    11. Call glRenderMode(GL_RENDER)
    12. Read through your selection buffer, to find the lowest z-value.

    Try doing some searches on the internet for these functions, and you should be able to work it out from there (it's a fairly tricky technique, so don't worry if it takes a while to get it working.)

    Good luck with it.

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2000
    Location
    FRANCE
    Posts
    9

    Re: Mouse selection

    thank you for your help but is there any sample ?

  4. #4
    Member Newbie
    Join Date
    Mar 2000
    Location
    UK
    Posts
    36

    Re: Mouse selection

    Probably.

    An internet search should find something easily enough (ther's a fair bit of online information about OpenGL).

    Good luck!

  5. #5
    Senior Member Regular Contributor
    Join Date
    Jan 2001
    Location
    Derry, NH
    Posts
    126

    Re: Mouse selection

    You can also try feedback function. Make your render mode to GL_FEEDBACK. It will tell you the screen coordinate of the object you draw with OpenGL. Note, the vertical coordinate of screen is up to down while what feedback tell is is down to up. Good Luck!

  6. #6
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Nov 2010
    Posts
    2,466

    Re: Mouse selection

    i have a sample on my site (url in profile)

  7. #7
    Junior Member Newbie
    Join Date
    Apr 2004
    Posts
    3

    Re: Mouse selection

    for the link in your profile doesn't work

Similar Threads

  1. Mouse selection
    By elect in forum OpenGL: Basic Coding
    Replies: 7
    Last Post: 03-01-2012, 11:22 AM
  2. new jogl version - mouse selection
    By TEMP USER in forum OpenGL: Basic Coding
    Replies: 2
    Last Post: 11-03-2010, 05:38 PM
  3. Z in mouse selection!
    By silver_angel in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 11-29-2003, 07:32 AM
  4. Selection with ray from mouse
    By elrick23 in forum OpenGL: Advanced Coding
    Replies: 3
    Last Post: 03-16-2002, 11:37 AM
  5. Selection with mouse drag
    By in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 01-12-2001, 05:01 AM

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