using more than one figure

I draw an ellipse and then i draw a square. After that i want to move the ellipse but not the square, can i do that?? How can i do it??

Well, it depends on the type of moevement you want. either if it is determined my the press of a button, or a predefined integer in a loop. Non the less it boils down to the use of integers, (floating points, doubles) to determine the positioning of the unit in the space. There are two ways to do so. That is doen by moving the “eye” or the view, or moving the scene.

you can move the scene, but it isn’t prolly the best way to utilize. I’d use glTranslatef, or glTranslated to do such a movement. Now according to the way you are looking at it you can move the unit 3 different ways.

X, Y, Z, and in that order in glTranslate.

Now you can define an int for all three, which would move the item in all three axis.
you can defien 2 ints. or 3. You would most likely want to use 3. A seperate controlable integer for each axis.

so IE:
glTranslatef(Xint,Yint,Zint);

How you want to control the values of these intergers is up to you, you can make an integer increase, or decrease, depending on the direction you want it to go. This can be accomplished in a loop, or in an if statement such that is used for key presses.
you could do:

if (keys[VK_LEFT])
{ // Is Up Arrow Being Pressed?
Xint+=0.2f;
}
if (keys[VK_RIGHT])
{ // Is Up Arrow Being Pressed?

Xint-=0.2f;

}

Using this, would move the unit, or item Left on the press of the left key, or, vise versa with the right key.

For mroe information on this kind of stuff, I would reccomend the best place for learning, http://NeHe.gamedev.net

glTranslate to move things around, but from reading your other post, you need to go through a few tutors’ on opengl. This would help you greatly in understanding opengl.

nehe.gamedev.net is a good place to start.

Originally posted by Ziggurat:
I draw an ellipse and then i draw a square. After that i want to move the ellipse but not the square, can i do that?? How can i do it??

Originally posted by Ziggurat:
I draw an ellipse and then i draw a square. After that i want to move the ellipse but not the square, can i do that?? How can i do it??

Is the problem that when you move one, the other moves also? If so, use glPushMatrix and glPopMatrix to “undo” previous transformations.