Object selection

Hi. How to implement the following feature.
I’ve painted many triangles with
glBegin(…)…glEnd().
Then I’d like to click some pixel in the window and define - which triangle I’ve just clicked.

Hi !

You use something called selection or picking, have a look at the following web sites.

http://www.helsinki.fi/~tksuoran/selection.html

http://www.unknownroad.com/rtfm/graphics/glselection.html

http://www.opengl.org/resources/tutorials/sig99/advanced99/notes/node35.html

http://www.codeproject.com/opengl/openglmousesellection.asp

Mikael