Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: Urgent : gluPickMatrix with VC++

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2000

    Urgent : gluPickMatrix with VC++

    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 [4];
    glGetIntegerv (GL_VIEWPORT, viewport);
    gluPickMatrix (xmouse, viewport [3] - 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

  2. #2
    Intern Newbie
    Join Date
    Mar 2000

    Re: Urgent : gluPickMatrix with VC++

    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..

    Hope this helps.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts