View Full Version : Urgent : gluPickMatrix with VC++
04-17-2000, 09:50 PM
I need some help because I have an urgent project to do and I have a problem with the picking. In fact, these 3 lines heve been given to me by experienced users but they used glut and not VC++ :
GLint viewport ;
glGetIntegerv (GL_VIEWPORT, viewport);
gluPickMatrix (xmouse, viewport  - ymouse, 1., 1., viewport);
i think it's a window coordinate problem.
I hope you can help me.
PS: sorry for my bad english but i'm french
04-20-2000, 02:50 AM
Your code is correct, I think that it's more likely that your problem lies in the code before or after this statement.
Just double check that you've carried out operations in this order:
1. Call glSelectBuffer
2. Call glRenderMode(GL_SELECT)
3. Select the projection matrix
4. Load identity
5. Call gluPickMatrix (as in your question)
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.
(this last part can be slightly awquard, unless you've made sure that there's only one name on the stack at the time)
I might have missed out a step or two.. http://www.opengl.org/discussion_boards/ubb/wink.gif
Hope this helps.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.