void mouse_event_method( int mseX, int mseY )
{
int w, h;
GetClientSize(&w, &h);
GLuint selectBuf[64];
GLint hits;
GLint viewport[4];
glGetIntegerv(GL_VIEWPORT, viewport);
glSelectBuffer(64, selectBuf);
(void) glRenderMode(GL_SELECT);
glInitNames();
glPushName(0);
glMatrixMode(GL_PROJECTION);
glPushMatrix();
glLoadIdentity();
gluPickMatrix(mseX, viewport[3]-mseY, 5.0, 5.0, viewport);
float aspect = (float)w / (float)h;
glFrustum(-VIEW*aspect, VIEW*aspect, -VIEW, VIEW, 1.0, 10.0);
DrawGrid();
glPopMatrix();
glFlush();
hits = glRenderMode(GL_RENDER);
if (hits > 0)
printf("hits: %d\n", (int)hits);
}