pick point

hallo, i have 10 points in 3D and would like to know how to pick any of them. thanks for any help

You can use gluUnproject to obtain the 3D position from say your mouse x/y position. You could then just loop through the 10 points and compare.

ok thanks for that, it worked. but how can i now move that picked point?

You can move point (or any other object) by modifying it’s coordinates before next frame.

For example:
If You used GLUT for window management, then You are drawing Your points in display Function, and handling kb and mouse events in callbacks passed to glutKeyboardFunc and glutMouseFunc.
You clicked one of your points, that triggered mouse callback where You should figure out which point was clicked and save it somewhere. When next click or move occurs it’s callback function will be triggered, using information saved earlier You can calculate new coordinates for your point (and call glutPostRedisplay() to trigger display callback and draw new scene).

You can also setup timer which redraws scene at specified rate,
so You do not have to worry about posting redisplays, just modify coordinates in callback.

btw. there is another simple method of picking, it’s called color picking:
Draw each object in unique color, read pixel at coordinates of click, now You can find out what was clicked comparing read value with colors of objects (You can use this method to pick any kind of objects (spheres, quads, complex models…), but it does not work very well if they are intersecting)

dzieki :wink: