Moving 3D objects

How can I move 3D objects,for example, by pressing the direction keys?

Have you try the glut Keyboard routine?

You can use variables to specify position of 3d objects. When you press a key, you can decrement or increment its value. You move the object with glTranslatef(x,y,z) before displaying the object.

Now I can’t remember the name of the glut function for keys, but if you have the specification, you can look it up.