where is this wrong?

The program is here.

void CTopView::OnLButtonDown(UINT nFlags, CPoint point)

GLuint CTopView::PickPoint(int x,int y)

GLuint selectBuf[BUFSIZE];
GLint hits;
GLint viewport[4];

glGetIntegerv(GL_VIEWPORT, viewport);

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


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); 


glPopMatrix ();
glFlush (); 

hits = glRenderMode(GL_RENDER);


anyone can tell me where this is wrong.

Could you please tell us what exactly doesnt’ work like it should?

Does it draw polygons in purple, when they should be orange? Or does it dial into your local Krogers and get 1/2 gal skim when you want 2%?

Some hints, please.