Original Post
am using the NeHe tutorial with some modifactions, with it i got picking too work, but then i need to be able to place objects after i picked them up, so for that i needed to use glOrtho(0,640,480,0,-1,1); so that i could use the mouse coords to place the object. So now i have decided that i may as well just draw everything with glOrtho(0,640,480,0,-1,1); but now picking does not work correctly, no matter where i click on the screen it detects a collision with my object, here is my selection code: void Selection(void) { GLuint buffer[512]; GLint hits; GLint viewport[4]; glGetIntegerv(GL_VIEWPORT, viewport); glSelectBuffer(512, buffer); (void) glRenderMode(GL_SELECT); glInitNames(); glPushName(0); glMatrixMode(GL_PROJECTION); glPushMatrix(); glLoadIdentity(); gluPickMatrix((GLdouble) mouse_x, (GLdouble) (viewport[3]-mouse_y), 1.0f, 1.0f, viewport); gluPerspective(45.0f, (GLfloat) (viewport[2]-viewport[0])/(GLfloat) (viewport[3]-viewport[1]), 0.1f, 100.0f); glMatrixMode(GL_MODELVIEW); DrawTargets(); glMatrixMode(GL_PROJECTION); glPopMatrix(); glMatrixMode(GL_MODELVIEW); hits=glRenderMode(GL_RENDER); if (hits > 0) { int choose = buffer[3]; x+=0.02f; pickedObject = choose; if (!object[choose].hit) { object[choose].x += 0.5; } } }