View Full Version : Mouse selection
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.
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
04-20-2000, 06:29 AM
thank you for your help but is there any sample ?
04-20-2000, 11:28 AM
An internet search should find something easily enough (ther's a fair bit of online information about OpenGL).
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!
i have a sample on my site (url in profile)
05-03-2004, 12:08 PM
for the link in your profile doesn't work
Powered by vBulletin® Version 4.2.2 Copyright © 2015 vBulletin Solutions, Inc. All rights reserved.