Select a vertex from a 3D object

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…

Nehe has a tutorial (number 32) that deals with picking.This should be what you’re after.