Select a vertex of a 3D object

Hi,
After pressing the mouse button,i need that all the vertices
that are the most closest to that vertex to be painted ,lets say
with a red color.
I think that i shold use glRenderMode(GL_SELECT) function
but i don’t know how…

Thanks.