picking objects on the viewport

I used glpushNames ( & glPopNames) to identify be able to pick an object on the screen using glPickMatrix.

HOwever, the name of the last object that I rendered on the screen seems to be identified with the whole window. THerefore, even if I click the mouse somewhere in the window but not on any object, it identifies the last object I’ve drawn.

what am I doing wrong??? … any suggestions where to start looking? I’ve ran over the code so many times !!! thanks!

Are you pushing the name before you draw and poping it right after? This is the only thing I can see. Do you have a sample of your code?