I have never tried working out how to do picking in OpenGL ( actually not done much at all in OpenGL ), but I found this article http://www.lighthouse3d.com/opengl/picking/ which seems to cover different techniques for doing it.