move

I am trying to find out something strange.Maybe i missed it somehow but for example i have two balls rendered on screen in different positions.i want to select exactly one of two balls and move themprobably with gltranslate?Ive tried to find an answer but unsuccessfully.i dont want a book(i have them).Some simple code please.Look:

a-O(first ball)--------->a-O(first ball moves-second one is still)

b-O(second ball)

if i want to translate it how can i select it?There are examples for one object but none for two.Please help.Eternally grateful.

For movement you need to set variables to track each ball’s position. And glTranslate to move them.

example:

glPushMatrix();
glTranslatef(Ball_1_x, Ball_1_y, Ball_1_z);
Draw_ball();
glPopMatrix();

glPushMatrix();
glTranslatef(Ball_2_x, Ball_2_y, Ball_2_z);
Draw_ball();
glPopMatrix();

Look at nehe.gamedev.net he has a good tutor on selection.