PDA

View Full Version : Mouse selection



Androme
04-18-2000, 06:01 AM
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

FATBUDDHA
04-20-2000, 03:28 AM
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. http://www.opengl.org/discussion_boards/ubb/smile.gif

Androme
04-20-2000, 06:29 AM
thank you for your help but is there any sample ?

FATBUDDHA
04-20-2000, 11:28 AM
Probably. http://www.opengl.org/discussion_boards/ubb/smile.gif

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

Good luck!

Rong Yao
04-17-2001, 08:20 AM
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!

zed
04-17-2001, 04:41 PM
i have a sample on my site (url in profile)

Digital-fol
05-03-2004, 12:08 PM
for the link in your profile doesn't work