select an object in select mode
Hi, i am not able to get the object select at every point of the object. Following is the code for my select funtion. I am drawing a bunch of lines in my draw function. I get the object ID at some point of the line only. I would appreicate if any one can help me and let me know what am i doing wrong?
int selection(int x, int y)
{
GLuint selectBuf[512];
GLint hits;
GLint viewport[4];
wglMakeCurrent (hDC, hgr);
glGetIntegerv (GL_VIEWPORT, viewport);
glSelectBuffer (512, selectBuf);
glRenderMode (GL_SELECT);
glInitNames();
glPushName(0);
glMatrixMode(GL_PROJECTION); // Selects The Projection Matrix
glPushMatrix(); // Push The Projection Matrix
glLoadIdentity();
/* create 5x5 pixel picking region near cursor location */
gluPickMatrix((GLdouble) x,(GLdouble) (viewport[3]-y), 10.0f, 10.0f, viewport);
gluPerspective(45.0f, (GLfloat) (1.33), 1.0f, 100.0f);
glMatrixMode(GL_MODELVIEW);
DrawGL(GL_SELECT);
glMatrixMode(GL_PROJECTION);
glPopMatrix();
glMatrixMode(GL_MODELVIEW);
hits = glRenderMode (GL_RENDER);
processHits (hits, selectBuf, x, y);
return 1;
}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement