Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 2 of 2

Thread: How to implement select-pick operation using VC++6.0

Hybrid View

  1. #1
    Junior Member Newbie
    Join Date
    Nov 2001
    Posts
    7

    How to implement select-pick operation using VC++6.0

    I want to select and pick objects using VC++6. Where does this function as follows will be put, in OnDraw() or OnLButtonDown()?
    How do I do?
    PickPoint(int x,int y)
    {
    GLuint selectBuf[BUFSIZE];
    GLint hits;

    glGetIntegerv(GL_VIEWPORT, viewport);

    glSelectBuffer (BUFSIZE, selectBuf);
    (void) glRenderMode (GL_SELECT);

    glInitNames();
    glPushName(-1);

    glMatrixMode (GL_PROJECTION);
    glPushMatrix ();
    glLoadIdentity ();
    gluPickMatrix((GLdouble)x, (GLdouble) (viewport[3] - y), 18, 18, viewport);
    gluPerspective(35.0, (GLfloat)viewport[2]/(GLfloat)viewport[3], 1.0f, 5000.0f);

    DrawMyObjects(GL_SELECT);

    glPopMatrix ();

    glFlush ();

    hits = glRenderMode(GL_RENDER);
    }

    Thanks!!!

  2. #2
    Member Regular Contributor
    Join Date
    Aug 2000
    Location
    Turin
    Posts
    269

    Re: How to implement select-pick operation using VC++6.0

    That function must be put in the mouse down of course, or you'll end calling infinite times the rendering himself recursively...

    Try to understand what it does before cut n' pasting it. ;D


    rIO.sK http://www.spinningkids.org/rio
    [rIO^sPINNING kIDS] - rio@nospam.spinningkids.org

    -/- This is a signature virus. Add it to your signature. Help it spreading! -/-

Posting Permissions

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